deutsch english
mvlcek online
software & more...
  • home
  • news
  • getsimple
    • i18n
    • navigation
      • breadcrumbs
      • left
      • top & left
      • pulldown & left
      • child pages
      • page navigation
      • independent menus
      • navigation demo
      • rendering
    • gallery
    • search
    • news
    • rss feeds
    • custom fields
    • special pages
    • math/formulas
    • pagify
    • dynamic pages
    • hits & visits
    • faq
    • editor
    • theme settings
    • less/scss
    • how to...
  • open source
  • faq
  • suchen
  • suchen (live)
  • rss
  • blog
  • sitemap
home » getsimple » navigation » page navigation

Page Navigation

If you need to show links on a page to the previous and next sibling pages, you can use the following code in a component named e.g. pagenav:

<?php
  $slug = (string) return_page_slug();
  $bc = return_i18n_breadcrumbs($slug);
  $level = count($bc) - 1;
  $nav = return_i18n_menu_data($slug,$level,$level,I18N_SHOW_PAGES);
  $i = 0;
  while ($i < count($nav) && $nav[$i]['url'] != $slug) $i++;
  if ($i > 0) {
    echo '<a href="'.find_i18n_url($nav[$i-1]['url'],$nav[$i-1]['parent']).
         '">&lt;&lt; '.$nav[$i-1]['title'].'</a>&nbsp;&nbsp;&nbsp;';
  }
  if ($i+1 < count($nav)) {
    echo '<a href="'.find_i18n_url($nav[$i+1]['url'],$nav[$i+1]['parent']).
         '">'.$nav[$i+1]['title'].' &gt;&gt;</a>';
  }
?>

Because of I18N_SHOW_PAGES it does not matter, if the pages are in the menu or not. You could also show the menu text with $nav[...]['menu'] or show previous and next links in separate components.

You can then include this component in your page using the DynPages plugin with

{% pagenav %}

or in your template using

<?php get_i18n_component('pagenav'); ?>

 

Here is an example of a page navigation:

<< Display child pages   Multiple independent menus >>
© 2025 mvlcek online
Powered by GetSimple