Page 1 of 1

Tag for looping previous/next pages

Posted: Mon Oct 16, 2006 2:37 pm
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.

Re: Tag for looping previous/next pages

Posted: Mon Oct 16, 2006 2:43 pm
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

Re: Tag for looping previous/next pages

Posted: Tue Oct 17, 2006 11:33 am
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.