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 total_pages > 1} work in wiki special page?

October 04, 2011 9:58am

Subscribe [3]
  • #1 / Oct 04, 2011 9:58am

    glenndavisgroup

    436 posts

    I’m setting up custom templates for my EE 2.2.1 website and I’m trying to customize the wiki search results page. I need to hide the search results pagination if there is only 1 page after a search is done. I’m trying to do something like this:

    {wiki:search_results limit="20"}
    ....
    
    {if total_pages > 1}
    {paginate}
    
    <div>Page {current_page} of {total_pages} pages {pagination_links}</div>
    {/paginate}
    {/if}
    {/wiki:search_results}

    The if statement above doesn’t seem to be working. This always displays the pagination info on the page. Is there any way to only show this when I have more than 1 page of results or is this a bug/limitation? Any help is appreciated.

    Thank you,

    Mike

  • #2 / Oct 04, 2011 10:17am

    columbusphil

    67 posts

    Mike,

    This may not be particularly helpful, but every time I’ve used total_pages, I’ve put it in brackets. Also, I think your paginate tags should be outside of your conditional.

    In other words:

    {paginate}
    {if {total_pages} > 1}
    blah…
    {/if}
    {paginate}

    Give it a shot and see if that helps…

     

  • #3 / Oct 04, 2011 11:33am

    glenndavisgroup

    436 posts

    Hi columbusphil,

    Thanks that did it. I can’t believe I didn’t think of moving the if in between the paginate tags. This is why sometimes you need a second pair of eyes 😊. By the way you don’t have to put the braces around the total_pages variable it works without them 😊. Thanks again.

    Mike

  • #4 / Oct 04, 2011 10:17pm

    Kevin Smith

    4784 posts

    Hey, thanks for the assist, columbusphil! Glad you were able to help get Mike squared away.

    Anyone I can help with before closing this up, Mike?

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

ExpressionEngine News!

#eecms, #events, #releases