Page 1 of 1

Previous / Next links only within the children

Posted: Mon Sep 12, 2011 9:37 pm
by skolzie
I would like to have previous / next links, but only within the children of a section. While the first page (2.1.) doesn't have a previous link to the previous Content page (1) the last item (2.5.) does have a next link to item (3.1.).

The problem is that I don't want the last Content Page 2.5. linking outside its siblings. Ideally it would not show a next link at all on this page.

I want it to be an extendable solution as lay users will be adding content to this section and it may not be the last item for long.

I have a menu like this:

1. Content
2. Section Header
2.1. Content
2.2. Content
2.3. Content
2.4. Content
2.5. Content
3. Section Header
3.1 Content
[etc]

My code looks like this:

Code: Select all

<p class="previous">{cms_selflink dir="previous" label=""}</p>
<p class="next">{cms_selflink dir="next" label=""}</p>
Any ideas?

[SOLVED] Re: Previous / Next links only within the children

Posted: Thu Sep 15, 2011 11:11 am
by skolzie
OK, looks like no one wanted to help!
However I have got a solution:

Code: Select all

{if $cgsimple->get_sibling(-1)}
   <p class="previous">{cms_selflink dir="previous" label=""}</p>
{/if}
{if $cgsimple->get_sibling(1)}
   <p class="next">{cms_selflink dir="next" label=""}</p>
{/if}

Re: Previous / Next links only within the children

Posted: Thu Sep 15, 2011 12:31 pm
by uniqu3
Sorry for that ;) maybe nobody knew an answer to your question or simply didn't see your post. But yes CGSimpleSmarty comes in handy there.