Question regarding next_album and next_news

Hi

I know that the developers have enough to do and help with theming isn't your top priority. Understandingly, but if anyone can nudge me in the right direction I would appreciate.

I'm trying to get the two next_album and next_news loops fit together on my index page. I managed it in a way: http://trondheimkunsthall.com/

I want albums and news to descend _together_ after published date though. Now the 10 last texts come first (as set at the zenpage plugin in admin-options.php?page=options&tab=plugin) and then the 10 last albums (as set in admin-options.php&tab=theme).

I am wondering: Where are the next_album and next_news functions declared?

My code is like this:

`


<?php while (next_news()): ;?>

<?php printNewsTitleLink(); ?><?php echo " <span class='newstype'>[tekster]"; ?>

<?php printNewsDate();?> | <?php echo gettext("Comments:"); ?> <?php echo getCommentCount(); ?> | <?php printNewsCategories(", ",gettext("Categories: "),"newscategories"); ?>

<?php echo getNewsContent(200); ?>



<?php endwhile; ?>

<?php while (next_album()): ?>

<?php endwhile; ?>

`
There is also another problem:

If I push the next page link, the first loop disappares. I must confess I don't understand how printPageListWithNav works either, because I recond it is there this other problem lies. Where is printPageListWithNav declared? (Maybe "declared" isn't the right word, I mean where is the code for the three functions.)

Comments

  • If I understand what you're describing correctly, the Combinews feature should be what you want. It will list albums as news (if the correct Zenpage option is set) and then you can simply use the next_news() function to iterate through both albums and news, effectively merging them together.

    The second problem is that you only have four news items published. Once all four of the news items have been printed to the first page, there are no more for any other pages. So say that you have 12 news items instead of four. If you had 12, you would see ten on the first page and two on the second page. On the third page, you would not have any news items left.

    FYI, `next_album()` is defined in `zp-core/template-functions.php` and `next_news()` is defined in `zp-core/plugins/zenpage/zenpage-template-functions.php`. `printPageListWithNav()` is also defined in `zp-core/template-functions.php`. All the Zenphoto functions can be found in the User Guide on the Zenphoto website, though it's suggested not to modify any of the core functions.
  • Thanks! I have to look on this tomorrow:-) I think I remember that I tried Combinews but that it didn't work for some reason. Well, I'll have to try.
  • acrylian Administrator, Developer
    kagutsuchi is right. You can't have the next_album and next_news loop on one page as they both use the same variable to determine pagination. So this leads to funny results. An alternative to CombiNews is to use the `printLatestNews()` function if you want the main albums loop.
  • The problem with Combinews is that I want one gallery.php with only the albums and one gallery1.php with both albums and news. As far as I remember I couldn't get Combinews dissabled in one of them. I'll just have to try to fool around till I find a solution.
  • acrylian Administrator, Developer
    Sorry, it is not possible to have the album and news loop on one page for the reasons explained above.
  • I haven't tried this so I'm not certain if it will work, but you may be able to use setOption() to override the Combinews option for your gallery.php with only albums. Then you can theme it how you like. You can read up on setOption() in the Theming Tutorial or look it up in the documentation found in the User Guide.
  • Even though I am kind of thickheaded now, would it not be possible to do something like this?

    `
    <? $i=1;
    while ($i<=8):
    if (next_newsDate() < next_albumDate())
    {
    next_news(); $i++; ?>
    some html formatting code

    <? }
    else
    {
    next_album(); $i++; ?>
    same here

    <? }
    endwhile; ?>
    `
  • acrylian Administrator, Developer
    We don't have functions like `next_newsDate()`and `next_albumDate()`. Also you can't put parts of a loop within an if clause, that nesting is not valid.

    Maybe you should explain what you are actually trying to do?
  • Yes, that would be a good starting point;-) I was trying to make a loop where albums _and_ news were processed alike regarding both time (only the last published albums and news) and the amount (for example that the loop prints the ten last posts; an album, two texts and the rest albums because that was what were the ten last posted items).

    Anyway, I have just made a new front page instead. It's more easy to plot in the html manually until I'm better in php.
Sign In or Register to comment.