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.

Confused About Pagination And Dynamic Parameter in Channel Entries Tag

August 02, 2012 3:41pm

Subscribe [2]
  • #1 / Aug 02, 2012 3:41pm

    FrankJohnson

    150 posts

    Friends:

    I’m in the midst of redesigning a site and I’ve come up against a problem I can’t seem to figure out.

    I’m trying to display an author’s entries based on their member_id being in the url. Here is an example of the url:

    <a href="http://www.insurancethoughtleadership.com/index.php/risk-transfer/expert_allarticles/2/">http://www.insurancethoughtleadership.com/index.php/risk-transfer/expert_allarticles/2/</a>

    Here is the channel entries tag on the page (I’ve stripped out a bunch of html - ultimately, I may need to include more of the code, but I’m thinking/hoping this might be enough):

    {exp:channel:entries channel="channels" author_id="{segment_3}" status="Open|Featured" limit="6" dynamic="no"}
    <span class="title">{title}</a></span>
    
    {summary}
    {paginate}
    Page {current_page} of {total_pages} pages {pagination_links}
    {/paginate}
    {/exp:channel:entries}

    You’ll notice that I have dynamic=“no” in the channel entries tag. This is (I assume) causing the pagination to not work - page 2 keeps loading the same entries as page 1.

    But if I remove dynamic=“no” from the channel entries tag, none of the entries display.

    Any thoughts on why this might be happening?

    Thanks in advance for any help anyone can offer - I really appreciate it.

    Frank

     

  • #2 / Aug 02, 2012 4:24pm

    Royama Design

    34 posts

    I’ll try a stab at this.

    You do need to have the dynamic=“no” parameter. With out it, the channel entries tag will assume you want to use your URL dynamically, and it will look to your segment_3 for the url_title of each entry. That’s why none of your entries show up. The only way one would show up is if it was titled “2”.

    As for the pagination, I think you are missing the paginate parameter from your channel entries tag. It should be something like:

    paginate="bottom"
  • #3 / Aug 02, 2012 4:35pm

    Royama Design

    34 posts

    Nope, I’m not quite right. I don’t think the paginate parameter is required.

    What does your URL look like when you click to page 2? Normally, pagination adds segment to identify which page you are looking at.

  • #4 / Aug 02, 2012 4:45pm

    FrankJohnson

    150 posts

    Thanks Sam. The page 2 url looks like this:

    <a href="http://www.insurancethoughtleadership.com/index.php/risk-transfer/expert_allarticles/2/P6">http://www.insurancethoughtleadership.com/index.php/risk-transfer/expert_allarticles/2/P6</a>

    But you’ve given me a thought. Elsewhere on the site, I’m using code like this (along with the MD Detect Page Type plugin and Mo’ Variables extension):

    {exp:md_detect_page_type url_segment="{segment_4}"}
    {if paginated}
    -- content for paginated page --
    {if:else}
    -- content for single entry page --
    {/if}
    {/exp:md_detect_page_type}

    to address a similar issue.

    Maybe there’s something for me in that approach. I had been trying that, but couldn’t seem to get it to work - the code I put in the first post in this thread was an attempt at simplifying the problem.

    Frank

  • #5 / Aug 02, 2012 6:43pm

    FrankJohnson

    150 posts

    Sam - actually, it looks like your first suggestion was correct - according to this bug report. When I added paginate=“bottom” to the channel entries tag, everything worked fine.

    Thanks so much!

    Frank

  • #6 / Aug 02, 2012 6:48pm

    Royama Design

    34 posts

    Ah, foiled by the Bug again. Glad you got it working.

  • #7 / Aug 02, 2012 10:45pm

    Lisa Wess

    20502 posts

    Thanks for helping out, Sam!

    It is documented to work this way

    Note: you may allow the tag to be sensitive to pagination data in the url by including the paginate= parameter. If that tag is used in conjunction with the dynamic parameter, the tag will act dynamically for pagination data only.

    I’m glad that you did get it working, and please let us know if you need any further assistance!

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

ExpressionEngine News!

#eecms, #events, #releases