Page 1 of 1

previous / next page only on sub-pages...

Posted: Thu Jun 14, 2007 9:02 am
by mrbs
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

Re: previous / next page only on sub-pages...

Posted: Mon Mar 17, 2008 12:50 pm
by Pierre M.
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.

Re: previous / next page only on sub-pages...

Posted: Mon Mar 17, 2008 6:29 pm
by calguy1000
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}

Re: previous / next page only on sub-pages...

Posted: Tue Mar 18, 2008 3:07 pm
by Pierre M.
Hello all,
calguy1000 wrote: I wouldn't, I'd use one template, and set some smarty variables in the metadata of the first and last child
Thank you calguy for this "automatic" tip.
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 ... }
(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.

Re: previous / next page only on sub-pages...

Posted: Tue Mar 18, 2008 3:41 pm
by calguy1000
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 :)

Re: previous / next page only on sub-pages...

Posted: Thu Mar 20, 2008 6:28 am
by pianoku
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}
Coolguy,

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

Posted: Mon Mar 16, 2009 4:29 pm
by Franck
I tried this on 2 sites, and can't make it work. where am I wrong ?
Is there another way to achieve this ?

Re: previous / next page only on sub-pages...

Posted: Mon Mar 23, 2009 4:57 pm
by Pierre M.
May be from 1.4+ the metadata solution needs according tuning of the new process metadata config switch ?

Pierre M.

Re: previous / next page only on sub-pages...

Posted: Mon Mar 23, 2009 6:23 pm
by RonnyK
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.
{$cgsimple->get_sibling("prev","prev_sibling")}{if !empty($prev_sibling)}{cms_selflink page="$prev_sibling" text="Previous"}{/if}
And the same for the next sibling
{$cgsimple->get_sibling("next","next_sibling")}{if !empty($next_sibling)}{cms_selflink page="$next_sibling" text="Next"}{/if}
Ronny

Re: previous / next page only on sub-pages...

Posted: Mon Mar 23, 2009 8:53 pm
by Franck
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...

Posted: Tue Mar 24, 2009 11:09 pm
by Dr.CSS
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...

Re: previous / next page only on sub-pages...

Posted: Sun Mar 29, 2009 6:05 pm
by Franck
Works perfectly ! My lack of english vocabulary prevented me from using it : I didn't know the word sibling...

Thanx RonnyK !