Navigation not working correctly?

If I understood correctly the albums and news pages use the same pagination and I'm including the same header on every page. So I'm using the same code as I am using for albums, but it doesn't seem to work properly. On my blog page I have the code for the news navigation in the middle, which works perfectly, but when you go to page 2 it shows (let's call it) the album navigation (on the left) only to go to the previous page and not for the next page. Also when you click the album navigation my blog suddenly has 10 pages and you click through every single news article instead of the ones I placed in the category 'blog'. How could I merge these two navigation to one and make it work correctly?

The link:
http://dagloos.com/lust/index.php?p=news&category=blog

The code for the news navigation:
'<?php printNewsPageListWithNav(gettext('NEXT »'), gettext('« PREV')); ?>'

The code for the album navigation:
'<?php if (hasPrevPage()) { ?>">« prv page<?php } ?>'
'<?php if (hasNextPage()) { ?>">nxt page »<?php } ?>'

Comments

  • acrylian Administrator, Developer
    No, you understood wrong and probably did not look at the functions documentation. Although they work similar the album loop and news loop use different functions for the pagination. `printNewsPageListWithNav()` vs `printPageListWithNav()`.

    You need to escape code examples properly so I cannot see what you do there. Anway `hasPrevPage/hasNextPage` again are album functions. For the news you have to use `getPrevNewsPageURL()`and `getNextNewsPageURL()` to check.
  • I keep looking and searching (forum, website, google). I only end up posting here when I just don't know what to do anymore, 'cause I already feel bad enough for not being able to figure out everything myself. I am learning as I go, when it comes down to PHP. Thanks for giving me the right code. I did find these in the documentation, but I just wanted to figure how to display these when there actually is a prev/next page. Thinking the album/news use the same pagination. I'm gonna try to figure out the rest now.
  • acrylian Administrator, Developer
    No problem. For the future you find the functions documentation via this:
    http://www.zenphoto.org/news/functions-documentation

    There are also quick links to general and zenpage template functions (A few are noted on the theming tutorial as well).
  • I got the navigation running :) Now the only thing that bothers me, and I can't figure out why, is that even if there is no next page the link shows, the previous page link works correctly. This is the code I'm using:

    `<?php if (hasNextPage()) { ?>">nxt page »<?php } ?>`
  • Seems you are close. This is the code I am using for pagination of my articles.

    `

    <?php if (getNextNewsPageURL() || getPrevNewsPageURL()){ ?> <?php } ?>

    `

    I see what you mean. You are ending up with a link to the same page you are on for your NEXT when at the end of the list.
  • acrylian Administrator, Developer
    I see it on the site as well. Did you try a standard theme? I cannot reproduce that even on our own site. Last page of the user guide category:
    http://www.zenphoto.org/news/category/user-guide/11
    As you see the next page is correctly disabled. It's just this:
    `printNewsPageListWithNav(gettext('next »'), gettext('« prev'),true,'pagelist',true);`
  • I grabbed the code from the zpMobile theme. I tested the navigation with that theme and it works as it should, but what I did was grab the code when the zpMobile theme displays one news article and adapted it to my needs. I used the `printNewsPageListWithNav()` before which works correctly now, but I just wanted to show the next/prev links like I did on the album pages. Perhaps I just should be just less of a perfectionist and just accept it ;)
  • acrylian Administrator, Developer
    but what I did was grab the code when the zpMobile theme displays one news article
    So you actually referring to the single article view with the next and prev article. That is something entirely different than the next_news loop pagination and only works if not using the CombiNews mode. The code for that is this (taken from Zenpage theme):
    `
    if(getPrevNewsURL()) { printPrevNewsLink(); }
    if(getNextNewsURL()) { printNextNewsLink(); }
    `
    By default singe article display also does not know category context. You can as a workaround add `&category=`to the url if you need that but it is not in the rewrite rules so it stays that way.
Sign In or Register to comment.