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.

Problem With Paginate Repeating

October 21, 2012 3:48pm

Subscribe [2]
  • #1 / Oct 21, 2012 3:48pm

    jsuissa

    147 posts

    When I use paginate code inside a channel entries tag the code repeats as many times as there are entries. So it will show 10 times when I want it to appear once.

    If I place the paginate code outside channel entries then it simply doesn’t work.
    Just not sure best way to resolve this.

    Thanks in advance for any advice on this.

    Entries Tag:

    {exp:channel:entries channel="communications" limit="10" orderby="entry_date" sort="desc"}
    }

    Paginate Code:

    <div class="paginate">   
    {paginate}
    
    {if previous_page}
    <a href="http://{auto_path}class=prev">Previous Page</a>  
    {/if}
    
    {if {current_page} != '1'   AND  "{current_page}" != "{total_pages}"  } | {/if}
    
    {if next_page}
    <a href="http://{auto_path}class=next">Next Page</a>
    {/if}
    
    {/paginate} 
    </div>
  • #2 / Oct 22, 2012 8:59pm

    Shane Eckert

    7174 posts

    Hey jsuissa,

    Can you check out the example in the other thread that you started and tell me if that does the same thing?

    I would also like to see all the template code so I can see where in the tag pair the paginate code is being placed.

    Thank you,

  • #3 / Oct 22, 2012 9:41pm

    jsuissa

    147 posts

    Thanks for the reply!

    I’ve figured it out—it’s only the <div class=“paginate”> and </div> that were repeating.

    The solution is simply to have ALL code within the {paginate} tag otherwise EE does exactly what it’s supposed to do, which is repeat the code as many times as the channel entries.

  • #4 / Oct 22, 2012 9:46pm

    Shane Eckert

    7174 posts

    Hi jsuissa,

    Nice! I did not catch that. Good work!

    Is there anything else I can help with?

    Cheers,

  • #5 / Oct 22, 2012 9:51pm

    jsuissa

    147 posts

    I wanted to add though, I noticed if I embedded the same exact code into another sub template, instead of inserting directly, it fails and just display {paginate} as if it were regular HTML.

    {paginate}
    <div class="paginate">  
    {if previous_page}
    <a href="http://{auto_path}class=prev">Previous Page</a>  
    {/if}
    
    {if {current_page} != '1'   AND  "{current_page}" != "{total_pages}"  } | {/if}
    
    {if next_page}
    <a href="http://{auto_path}class=next">Next Page</a>
    {/if}
    </div>
    {/paginate}
  • #6 / Oct 22, 2012 10:00pm

    Shane Eckert

    7174 posts

    Hi jsuissa,

    Do you mean, embedding pagination code inside of a channel entries tag pair?

    That’s going to mess with Parse Order. Processing an embedded template is one of the last things the parser does. You will need to include the entire channel entries tag pair in your embed.

    Does that make sense?

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases