Tag for looping previous/next 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.
Post Reply
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Tag for looping previous/next pages

Post by Jonny »

I'm putting together a picture gallery for a non-techie end-user and currently using the {cms_selflink} tag to generate links to the previous and next pages.

Problem is: how to loop the last page back to the first and vice versa without resorting to a separate template for these two? As the end-user will be adding new pages I need to keep the system as simple as possible.

I'm sure there must be a easy solution.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: Tag for looping previous/next pages

Post by tsw »

you could edit cms_selflink code and add a new param, like loop and check if there is no next page show first page link..

or with smarty something like this (in pseudo, dont have time to look through smarty manual)

if(cms_selflink dir next =="")
  cms_selflink home
else
  cms_selflink next

doing it in cms_sefllink is probably faster and easier to use

hope this helps
Jonny
Forum Members
Forum Members
Posts: 77
Joined: Sun Sep 24, 2006 10:49 am

Re: Tag for looping previous/next pages

Post by Jonny »

Thanks for your suggestion. I'm sure it's a breeze for anyone familiar with the guts of PHP, but a little outside my own capability.
Post Reply

Return to “CMSMS Core”