previous / next page only on sub-pages...
previous / next page only on sub-pages...
I have made a template used only for the sub-pages 2.1 - 2.8
On these pages I am using the tag cms_selflink, with the next- and previous funktion added, to switch between these pages.
My problem is, that on the first page I am also allowed to jump to page 2.0 - which doesn't show the prev/next-buttons. It is the same situation on page 2.8, where I can jump to page 3.0... This is not suitable for the situation.
So what i ask for is, that on page 2.1 only the next page is shown, and on page 2.8 only the previous page is shown... Can this be done automatically??
MS
On these pages I am using the tag cms_selflink, with the next- and previous funktion added, to switch between these pages.
My problem is, that on the first page I am also allowed to jump to page 2.0 - which doesn't show the prev/next-buttons. It is the same situation on page 2.8, where I can jump to page 3.0... This is not suitable for the situation.
So what i ask for is, that on page 2.1 only the next page is shown, and on page 2.8 only the previous page is shown... Can this be done automatically??
MS
Re: previous / next page only on sub-pages...
Hello,
I would make 3 templates :
-one for page 2.1 with only the "next page" link.
-one for page 2.n with only the "previous page" link.
-one for all the n-2 pages inbetween with both links.
Pierre M.
I would make 3 templates :
-one for page 2.1 with only the "next page" link.
-one for page 2.n with only the "previous page" link.
-one for all the n-2 pages inbetween with both links.
Pierre M.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: previous / next page only on sub-pages...
I wouldn't, I'd use one template, and set some smarty variables in the metadata of the first and last child
i.e (in the first child):
{assign var='firstchild' value='1'}
and in the last child:
{assign var='lastchild' value='1'}
Then in my page template, I'd use:
{if !isset($firstchild)}{cms_selflink dir='prev'...}{/if}
and then
{if !isset($lastchild)}{cms_selflink dir='next'...}{/if}
i.e (in the first child):
{assign var='firstchild' value='1'}
and in the last child:
{assign var='lastchild' value='1'}
Then in my page template, I'd use:
{if !isset($firstchild)}{cms_selflink dir='prev'...}{/if}
and then
{if !isset($lastchild)}{cms_selflink dir='next'...}{/if}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: previous / next page only on sub-pages...
Hello all,
Users can chose which solution they prefer when adding/reordering pages : modifying metadata or reassigning template.
Or what about making this "only one template" solution a feature of {cms_selflink dir='prev/next... } ?
Something like
(there would be no need of metadata setting and maintaining because the selflink code "knows" there is no prev/next at same level)
Pierre M.
Thank you calguy for this "automatic" tip.calguy1000 wrote: I wouldn't, I'd use one template, and set some smarty variables in the metadata of the first and last child
Users can chose which solution they prefer when adding/reordering pages : modifying metadata or reassigning template.
Or what about making this "only one template" solution a feature of {cms_selflink dir='prev/next... } ?
Something like
Code: Select all
{cms_selflink dir='prev|next' noprevonfirst=true nonextonlast=true ... }
Pierre M.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: previous / next page only on sub-pages...
Well, I'll think about adding a couple of methods into cgsimplesmarty..... cms_selflink is ugly and gross and I don't want to add any more code into it 

Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: previous / next page only on sub-pages...
Coolguy,I wouldn't, I'd use one template, and set some smarty variables in the metadata of the first and last child
i.e (in the first child):
{assign var='firstchild' value='1'}
and in the last child:
{assign var='lastchild' value='1'}
Then in my page template, I'd use:
{if !isset($firstchild)}{cms_selflink dir='prev'...}{/if}
and then
{if !isset($lastchild)}{cms_selflink dir='next'...}{/if}
Please describe more details which smarty on which template or pages content area. Thanks
I am a newbie. Thanks so much.
RS
Re: previous / next page only on sub-pages...
I tried this on 2 sites, and can't make it work. where am I wrong ?
Is there another way to achieve this ?
Is there another way to achieve this ?
Re: previous / next page only on sub-pages...
May be from 1.4+ the metadata solution needs according tuning of the new process metadata config switch ?
Pierre M.
Pierre M.
Re: previous / next page only on sub-pages...
Or use CGSimpleSmarty,
which has the parameters included, to know if a page is a sibling....
F.e. this logic, coming from the help of CGSimpleSmarty, which could be set in the template.
which has the parameters included, to know if a page is a sibling....
F.e. this logic, coming from the help of CGSimpleSmarty, which could be set in the template.
And the same for the next sibling{$cgsimple->get_sibling("prev","prev_sibling")}{if !empty($prev_sibling)}{cms_selflink page="$prev_sibling" text="Previous"}{/if}
Ronny{$cgsimple->get_sibling("next","next_sibling")}{if !empty($next_sibling)}{cms_selflink page="$next_sibling" text="Next"}{/if}
Re: previous / next page only on sub-pages...
I was wondering if it was possible with this extension, I'll try this then. Thanx a lot !
Re: previous / next page only on sub-pages...
Lord Nogard
The 3 self links you are using/talking about are in the very top of the page and are used for screen readers and never actually show on the page, just thought I'd let you know...
The 3 self links you are using/talking about are in the very top of the page and are used for screen readers and never actually show on the page, just thought I'd let you know...
Re: previous / next page only on sub-pages...
Works perfectly ! My lack of english vocabulary prevented me from using it : I didn't know the word sibling...
Thanx RonnyK !
Thanx RonnyK !