Previous / Next links only within the children

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
skolzie
New Member
New Member
Posts: 2
Joined: Mon Sep 12, 2011 9:23 pm

Previous / Next links only within the children

Post 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?
skolzie
New Member
New Member
Posts: 2
Joined: Mon Sep 12, 2011 9:23 pm

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

Post 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}
uniqu3

Re: Previous / Next links only within the children

Post 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.
Post Reply

Return to “CMSMS Core”