ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Why doesn't {if previous_page && next_page} / {/if} work?

February 15, 2011 9:01am

Subscribe [6]
  • #1 / Feb 15, 2011 9:01am

    Daniel H

    197 posts

    In the following code:

    {if previous_page}<a href="http://{auto_path}">Previous</a>{/if}{if previous_page && next_page} / {/if}{if next_page}<a href="http://{auto_path}">Next</a>{/if}

    “NextPrevious” is displayed, even though there is obviously both a previous and next page. Why does it refuse to display the slash?

  • #2 / Feb 15, 2011 11:52am

    jcowen

    66 posts

    What happens if you replace the ‘/’ with

    /

    ?

  • #3 / Feb 15, 2011 3:33pm

    SharonGeorge

    19 posts

    I am having the same problem.  I want to display a divider between my next and previous links, but only if they both appear.

    {if previous_page && next_page}
     | 
    {/if}

    This is not working.  I also tried comparing the total pages to the current page, that didn’t work either.  Any help would be appreciated!

    Sharon

  • #4 / Feb 15, 2011 11:57pm

    John Henry Donovan

    12339 posts

    Daniel,

    You can’t unfortunately use that syntax with a simple global conditional. You can however do this

    {paginate}
    
    {if previous_page}
    <a href="http://{auto_path}">Previous Page</a>  
    {/if}
    
    {if {current_page} != '1'   AND  "{current_page}" != "{total_pages}"  } | {/if}
    
    {if next_page}
    <a href="http://{auto_path}">Next Page</a>
    {/if}
    
    {/paginate}

    Let us know if that helps

  • #5 / Feb 16, 2011 2:24am

    SharonGeorge

    19 posts

    Worked for me!  Thanks for letting me share the post!!

    Sharon

  • #6 / Feb 16, 2011 2:13pm

    Sue Crocker

    26054 posts

    Daniel, what about you? Sharon, glad that’s working for you.

  • #7 / Feb 17, 2011 3:55am

    Jacob Roebuck

    4 posts

    This is very helpful.

    Perhaps someone with a high enough rank can post a user note here:

    http://ellislab.com/expressionengine/user-guide/modules/channel/pagination_page.html

  • #8 / Feb 17, 2011 3:11pm

    Ingmar

    29245 posts

    Thanks, Jacob. Daniel, where are you with this?

  • #9 / Feb 23, 2011 7:41am

    Daniel H

    197 posts

    So sorry - notifications for replies didn’t seem to come through.

    This works perfectly now - thanks!

  • #10 / Feb 23, 2011 7:52am

    Ingmar

    29245 posts

    Glad to see you’re all set. Please post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases