sort of news in reverse chronological order

vincent3569 Member, Translator
hello

I use zenphoto with zenpage

Is it possible to add a sorting of news in reverse chronological order?

Indeed, the loop with news (with the navigation bar), the latest news is on page 1, the oldest is on page 4 (for example).

I would like the latest news is on page 4 and the oldest is on page 1 (same example).
->button previous news would see older news
->button next news would see the latest news

maybe, by adding a sort option in the function printNewsPageListWithNav
maybe, by adding a sort option in the admin tab...

thanks for your advice

Comments

  • acrylian Administrator, Developer
    It is quite standard that the latest news as it is the most important is upfront. However, it is already there: http://www.zenphoto.org/documentation/plugins/zenpage/_zp-extensions---zenpage---zenpage-template-functions.php.html#functionnext_news
  • vincent3569 Member, Translator
    well, it's a good news !

    but is it the function printNewsPageListWithNav use these sorting options ?

    see http://vincent.bourganel.free.fr/zenphoto/index.php?p=news
    news1 (oldest one) is on page 2 and news4 (newest one) is on page 1.

    if we are with ascending order, we should have news4 on page 2 and news1 on first page : previous is too see older news.
  • acrylian Administrator, Developer
    Sure that you set the parameters correctly? printNewsPageListWithNav is dependent on the loop.
  • acrylian Administrator, Developer
    I just tried, works as expected for me. Note you have to set both parameters.
  • vincent3569 Member, Translator
    maybe there's something I do not understand.

    actualy, i do a loop with
    <?php while (next_news("date","desc")): ;?>
    ...
    <?php endwhile; ?>
    <?php printNewsPageListWithNav(" » "," « ",true); ?>

    but navigation still not works as well and whatever sort order and sort direction, the display still the same

    could you explain how set those parameters and how correctly use them with printNewsPageListWithNav ?
  • acrylian Administrator, Developer
    Well, you actually did it correctly except that you need of course to use "asc" (ascending) instead of "desc" (descending) to get the oldest to newest direction. The printNewsPagesListWithNav() does not require any special settings.
  • vincent3569 Member, Translator
    "The printNewsPagesListWithNav() does not require any special settings. "

    i'm not agree with that : it's ok if you are with ascending sort but it's not logical if you are with descending sort.

    with this sort option, you should displayed the last page of news (and not the 1st one), and on navigation bar, previous page shown oldest news, next page shown newest.

    Similarly, if you are on single news article, previous and next links should show oldest single news or newest single news.

    what you think about it ?
  • acrylian Administrator, Developer
    Sorry, I can't see any issue with the printNewsPagesListWithNav() function. If you tell the next_news() loop to be ascending that function is also mirroring that. If it does not it might be your theme. Note that for example the zenpage theme has two loops!: One
    on the gallery.php page if you use the "news on index" option and one on the news.php page. Of course both need to be set to asc.
    See Here: http://zenphoto.maltem.de/

    It might be that "title" sorting does not work correctly if using the multilingual mode though. I have to look at that.

    I agree however that the prev/next links for hte single news should also be reversed (prev oldest / next newest). I will add options to those as well (I will not make this an backend option for the sake of flexibility as you can theoretically use loops on other pages as well).

    Update: Tonight's nightly will have the same parameters like the next_news() function.
  • Thanks for solution.
  • vincent3569 Member, Translator
    thanks for your help.

    could you explain what the evolution is ? there's nothing in the documentation.
  • acrylian Administrator, Developer
    The documentation is of course only for the current official release not hte nightlies. The documentation is always in the files itself.
    Look at the news.php page's single article display at the next/prev article function. You can just copy over as parameters what you set for the next_news().
Sign In or Register to comment.