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

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

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

Post 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
Pierre M.

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

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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}
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.
Pierre M.

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

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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 :)
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.
pianoku
Forum Members
Forum Members
Posts: 15
Joined: Tue Dec 11, 2007 4:58 am

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

Post 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
User avatar
Franck
Dev Team Member
Dev Team Member
Posts: 261
Joined: Tue Jun 12, 2007 1:29 pm

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

Post 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 ?
Pierre M.

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

Post by Pierre M. »

May be from 1.4+ the metadata solution needs according tuning of the new process metadata config switch ?

Pierre M.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

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

Post 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
User avatar
Franck
Dev Team Member
Dev Team Member
Posts: 261
Joined: Tue Jun 12, 2007 1:29 pm

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

Post by Franck »

I was wondering if it was possible with this extension, I'll try this then. Thanx a lot !
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post 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...
User avatar
Franck
Dev Team Member
Dev Team Member
Posts: 261
Joined: Tue Jun 12, 2007 1:29 pm

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

Post by Franck »

Works perfectly ! My lack of english vocabulary prevented me from using it : I didn't know the word sibling...

Thanx RonnyK !
Locked

Return to “CMSMS Core”