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.

Controlling pagination's next/prev output

February 10, 2011 1:20pm

Subscribe [3]
  • #1 / Feb 10, 2011 1:20pm

    roryrabbitfield

    320 posts

    I am using pagination in a channel tag. I need to use a custom image for my “previous” and “next” links, not the < and > chars that get output automatically. I can hard code those in and get the links working using {auto_path}. But I can’t get rid of the < and > which appear.

    My code:

    {exp:channel:entries channel="visual_diary_archive" disable="categories|category_fields|member_data" dynamic="off" paginate="bottom" limit="1"}    
    {paginate}
    {if previous_page}
    <li class="prev"><a href="http://{auto_path}">prev</a></li>
    {/if}
    <li>{pagination_links} of {total_pages}</li>
    {if next_page}
    <li class="next"><a href="http://{auto_path}">next</a></li>
    {/if}
    {/paginate}                    
    {/exp:channel:entries}

    You can see I am inserting a class=“next” in the LI that contains the prev/next. With CSS I am using a BG image and hiding the text “prev” and “next”. That’s working fine. But my problem is that this code:

    <li>{pagination_links} of {total_pages}</li>

    generates the < and > links that I want to get rid of. Possible?

  • #2 / Feb 11, 2011 3:38am

    John Henry Donovan

    12339 posts

    Rory,

    that type of pagination is for a listing page where you show multiple entries. Looking at your channel:entries tag it looks like a single entry page. Is that correct?

    You cannot use the parameter dynamic= with that pagination either

    These are the tags you should be using outside your channel:entries tag for single entry pagination

    To answer your specific question you would need to use a plugin like Low replace to remove those links

  • #3 / Feb 11, 2011 12:36pm

    roryrabbitfield

    320 posts

    Ah, I had set the channel tag to limit=1 just because I was testing the pagination and since there were only 2 entries,  I needed to limit them to 1 to force the pagination to show. But yes, this is a multi-entry page, when there are more entries there will be 12 per page. Is it still true with the multi-entry concept that I cannot use dynamic= in the channel tag? I’m not sure why not, I want to bring in everything, up to the limit.

    Other than that minor question, I think with your suggestion about Low replace I am all set. Also, your note about single entry pagination was a life saver in another coding quandary I had on another page, so double thank you!

  • #4 / Feb 11, 2011 2:26pm

    Barry Cogan

    291 posts

    Delighted that’s working out for you!

    with regards to the dynamic=no it is used for content you want to be the same no matter what page you are on. Pagination is a dynamic function by nature show dynamic should not be “no”.

    Please post again with any future issues 😊

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

ExpressionEngine News!

#eecms, #events, #releases