0
votes

I need some assistance with looping expression engine entries. I've hit a brick wall with a website i've been working on. Basically the site has 6 latest projects at the bottom with next and prev icons to the left and right. When you reach the end of the projects there is a back to start of projects button that brings the user back to the start of the projects... well, the client doesn't want this anymore and just wants the entries have an infinite loop!

Is this possible with EE, is there an add-on for looping entries I could use?

My code is:

{exp:channel:next_entry category_group="1" category="{categories}{category_id}|{/categories}"}
<a class="rightNav" href="{id_path='projects-test/view'}" style="color:#000;"><<</a>
{/exp:channel:next_entry}

{embed="projects-test/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}" category_id="{categories show_group="1" limit="1"}{category_id}{/categories}"}

{exp:channel:prev_entry category_group="1" category="{categories}{category_id}|{/categories}"}
<a class="leftNav" href="{id_path='projects-test/view'}" style="color:#000;">>></a>
{/exp:channel:prev_entry}

{/exp:channel:entries}

Related template code:

{exp:channel:entries channel="project" limit="6" category_group="1" stop_before="{embed:stop_before}" related_categories_mode="yes" custom_fields="yes"}
{if count == "1"}<ul id="filmStrip">{/if}
<li>
{exp:imgsizer:size src="{project_image}" height="68px" width="137px"}
<a href="{title_permalink='projects-test/view'}"><img src="{sized}" height="{height}" width="{width}" alt=""/></a>
{/exp:imgsizer:size}
<a href="{title_permalink='projects-test/view'}"><p class="thumbTitle">{title}</p></a>
</li>
{if count == total_results}</ul>{/if}
{/exp:channel:entries}
1
Expression Engine doesn't often show up here, so response will be limited. Try over at expressionengine.com/forums - adlawson
Believe it or not, i've had a lot better help here in the past than I have on their forums. Their community isn't very helpful. - John Stant
One of the drawbacks of a system that's as flexible and powerful as EE is that something that sounds simple like "looping entries" is actually quite tricky, as there's no one order of or limit on any list of entries. The ordering and length of any result can be vary so widely. - Derek Hogue

1 Answers

0
votes

This plugin may do the trick for you.

Usage probably looks like this:

{exp:bbr_prevnext_entry current_entry_id="{entry_id}" category="{categories}{category_id}|{/categories}" channel_name="project" orderby="entry_date" sort="desc" return_fields="entry_id" cycle="yes"}   
    <a class="rightNav" href="/projects-test/view/{next_entry_id}" style="color:#000;"><<</a>
{/exp:bbr_prevnext_entry}

{embed="projects-test/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}" category_id="{categories show_group="1" limit="1"}{category_id}{/categories}"}

{exp:bbr_prevnext_entry current_entry_id="{entry_id}" category="{categories}{category_id}|{/categories}" channel_name="project" orderby="entry_date" sort="desc" return_fields="entry_id" cycle="yes"}   
    <a class="leftNav" href="/projects-test/view/{prev_entry_id}" style="color:#000;">>></a>
{/exp:bbr_prevnext_entry}