Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi again,

So I have this little snippet, which works really well for cycling through my portfolio pages without having to constantly go back to the pain portfolio list page:

<cms:if k_prev_nestedpage_link >
<a href="<cms:show k_prev_nestedpage_link />">&laquo; <cms:show k_prev_nestedpage_title /></a> •
</cms:if>
<cms:if k_next_nestedpage_link >
<a href="<cms:show k_next_nestedpage_link />"><cms:show k_next_nestedpage_title /> &raquo;</a>
</cms:if>

My question is, when I get to the end of my list, the 'next' button disappears, or if I'm at the beginning of my list, the 'prev' button disappears. Is there a way to make it so this list loops, going from the last portfolio page to the first when it reaches the end? So for the sake of my site as it stands, can I make the last item, 'The Journey' go to next, which would be the first item, '3D Chiro'?

Attachments

Hello,
accordingly to Docs (http://www.couchcms.com/docs/tags-refer ... pages.html) there are "k_first_child" and "k_last_child" are available for Nested Pages. So, maybe solution fot the link would be:
Code: Select all
Instead of:

<cms:if k_prev_nestedpage_link >
<a href="<cms:show k_prev_nestedpage_link />">&laquo; <cms:show k_prev_nestedpage_title /></a> •
</cms:if>

Use:

<cms:set np_prevlink="<cms:if k_prev_nestedpage_link ><cms:show k_prev_nestedpage_link /><cms:else /><cms:nested_pages><cms:if k_nestedpage_name=k_last_child><cms:show k_nestedpage_link /></cms:if></cms:nested_pages></cms:if>" />

<a href="<cms:show np_prevlink />">&laquo; <cms:show k_prev_nestedpage_title /></a> •

And something like that for title, too. It's just a logic tip, not a working solution)
Please try the following -
Code: Select all
<cms:if k_prev_nestedpage_link >
    <a href="<cms:show k_prev_nestedpage_link />">&laquo; <cms:show k_prev_nestedpage_title /></a> •
<cms:else />
    <cms:nested_pages paginate='1' limit='1' order='desc'>
       <a href="<cms:show k_nestedpage_link />">&laquo; <cms:show k_nestedpage_title /></a> •
    </cms:nested_pages>
</cms:if>

<cms:if k_next_nestedpage_link >
    <a href="<cms:show k_next_nestedpage_link />"><cms:show k_next_nestedpage_title /> &raquo;</a>
<cms:else />
    <cms:nested_pages paginate='1' limit='1' order='asc'>
       <a href="<cms:show k_nestedpage_link />"><cms:show k_nestedpage_title /> &raquo;</a>
    </cms:nested_pages>
</cms:if>

Hope this helps.
@KK Fantastic as always, it works perfectly. Thanks!
4 posts Page 1 of 1