Personal tools

Translations of this page:
You are here: Getting started » developer » code_snippets » Create links to "Previous page" and "Next page"
Trace: » Using Smarty in external applications » URL Rewriting » Create links to "Previous page" and "Next page"

Create links to "Previous page" and "Next page"

This is a quite common task in CMS Systems, so this a working example, which you are allowed to beautify LOL

{load_item_childs id=$MENU->getParentID() assign="bla"}
{if count($bla) > 0}
  {foreach from=$bla item="cur"}
  {if isset($last2) && $last2->getID() == $MENU->getID()}
    {assign var="next" value="$cur"}
  {/if}
  {if !isset($next) && $cur->getID() != $MENU->getID()}
    {assign var="last" value=$cur}
  {/if}
  {assign var="last2" value=$cur}
  {/foreach}
{/if}
 
{if isset($last) || isset($next)}
<div>
{if isset($last)}
 <a href="{link item=$last}">Letzte Seite</a>
{/if}
{if isset($next)}
 <a href="{link item=$next}">Nächste Seite</a>
{/if}
</div>
{/if}
 

Recent changes RSS feed Valid XHTML 1.0 Valid CSS