Navigation across multiple pages

To navigate back to the sides within a module of which the user has come, you have to remember the appropriate page views to fall back later on this information.

This is done with the Class Navigation (navigation.php). In the common.php a global object of that class is created. This property is available everywhere in $_SESSION['navigation'].

The object is to collect all the URLs that a user visits within a module. So then you have the possibility to navigate again to the right side back. However, the URL-collection must be properly cared by us. For this purpose, the object has several methods.

When you access a module this object must be initialized, because it might be already filled in other modules with URLs.

 $_SESSION['navigation']->clear(); 

Now, all pages that are called, (the first module side) are added to this object

 $_SESSION['navigation']->addurl(CURRENT_URL); 

Is there somewhere a Back button, so this was occupied either with JavaScript history.back() or a fixed URL. This is now no longer necessary. Here you can then simply call the php page:

 $g_root_path/adm_program/system/back.php 

If a page was left again without back navigation, this must also be removed from the object. This is working with

 $_SESSION['navigation']->deleteLastUrl(); 

This is for example the case when you want to change an appointment. Then, the edit page must first be added to the object with addurl. Now, if the date changed and saved, you end up in dates_function script. Since this has no output, it does not need to be added to the object itself, but it must be deleted the previous page of this object with deleteLastUrl on successful saving.

A note about the back.php script. This always calls on THE NEXT TO LAST page of the object, as often the last page in the object is the current page.

  • en/entwickler/navigation_ueber_mehrere_seiten.txt
  • Last modified: 2016/12/03 15:04
  • by ximex