All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

prev_entry, next_entry do not work?

ByteMyPixel 14 Dec 2011 21:00 problem, rejected

Hello :?)

My problem is that I'm not able to get the previous and next links to work.

Here's my code:

{exp:channel:entries channel="{staticchannel}" entry_id="{structure:page:entry_id}" limit="1" url_title="{freebie_2}" disable="member_data|pagination|trackbacks"}

...irrelevant code...

<div id="pager"><a href="{exp:low_reorder:prev_entry}" class="previous"></a><a href="{exp:low_reorder:next_entry}" class="next"></a></div>

{/exp:channel:entries}


FYI I tested the structure page entry id to be sure it is pulling in the correct data and it is.

Can you tell me what I'm missing?

Thank you!!!

Replies

  1. Low 14 Dec 2011 22:20

    Hi! The prev/next tags are tag pairs, which means you'll need to open and close them, as you can see in the examples in the docs. Something like this:

    {exp:low_reorder:prev_entry field="low_reorder_field" entry_id="{entry_id}" prefix="prev_"} 
    <a href="{path="template_group/template/{prev_url_title}"}" class="previous">{prev_title}</a>
    {/exp:low_reorder:prev_entry}


    The next_entry tag will work in the same way.

  2. ByteMyPixel 15 Dec 2011 00:00

    Oh wow, I don't know how I totally missed that, WOOPS!

    But it still isn't working, I've simplified my template to:


    {exp:channel:entries channel="unit_page" entry_id="{structure:page:entry_id}" url_title="{segment_2}" limit="1" disable="member_data|pagination|trackbacks"}

    <h1>{title}</h1>

    {exp:low_reorder:prev_entry field="low_reorder_field" entry_id="{entry_id}" prefix="prev_" no_results="This is the first page"}
    Previously: <a href="{path="services/{prev_url_title}"}">{prev_title}</a>
    {/exp:low_reorder:prev_entry}

    {exp:low_reorder:next_entry field="low_reorder_field" entry_id="{entry_id}" prefix="next_" no_results="This is the last page"}
    Next up: <a href="{path="services/{next_url_title}"}">{next_title}</a>
    {/exp:low_reorder:next_entry}

    {/exp:channel:entries}


    Any other ideas?

  3. Low 15 Dec 2011 07:59

    Yes, change "low_reorder_field" to the actual short name of your reorder field and make sure you change the path in the link to something that works for you.

  4. ByteMyPixel 15 Dec 2011 17:07

    Hi Low,

    Thanks for being so quick to help!

    I pasted the code above without my edits to it, woops again. So to be more thorough and detailed and to clarify:

    What I actually had that wasn't working:



    {exp:channel:entries channel="unit_page" entry_id="{structure:page:entry_id}" url_title="{segment_2}" limit="1" disable="member_data|pagination|trackbacks"}

    <h1>{title}</h1>

    <p>{exp:low_reorder:prev_entry field="re_order_listings" entry_id="{structure:page:entry_id}"}<a href="{path='properties/{prev_url_title}'}" class="previous">Previous</a>{/exp:low_reorder:prev_entry}</p>

    <p>{exp:low_reorder:next_entry field="re_order_listings" entry_id="{structure:page:entry_id}"}<a href="{path='properties/{next_url_title}'}" class="next">Next</a>{/exp:low_reorder:next_entry}</p>

    {/exp:channel:entries}



    The links showed up, but I wasn't getting the right path: http://mydomain.com/properties/{next_url_title'}

    And then what did work:


    {exp:channel:entries channel="unit_page" entry_id="{structure:page:entry_id}" url_title="{segment_2}" limit="1" disable="member_data|pagination|trackbacks"}

    <h1>{title}</h1>

    <p>{exp:low_reorder:prev_entry field="re_order_listings" entry_id="{structure:page:entry_id}" prefix="prev_"}<a href="{path='properties/{prev_url_title}'}" class="previous">Previous</a>{/exp:low_reorder:prev_entry}</p>

    <p>{exp:low_reorder:next_entry field="re_order_listings" entry_id="{structure:page:entry_id}" prefix="next_"}<a href="{path='properties/{next_url_title}'}" class="next">Next</a>{/exp:low_reorder:next_entry}</p>

    {/exp:channel:entries}



    They key being the "prefix" parameters :)

    Now it works perfectly, thanks again!

  5. Diadyo 20 Feb 2012 17:50

    Hi. When using nested links I can only display fields title and url_title with the prefix. For example when I try to display next_my_custom_field nothing happens... But next_title or next_url_title works just fine. Is the prefix only limited to title and url_title?

  6. Low 20 Feb 2012 21:31

    Diadyo, only Title, URL Title and Entry ID are available in the prev/next entry tags.