Navigation
From PHPDevShell
Contents |
The Navigation System
PHPDevShell has a smart navigation system. It uses unique menu id's that is created by directories and names making it possible to pre-determine what a menu id is going to be. This is very useful when you write your application and know what the menu id is going to be.
I want my own Home Page
To setup your own home page, you simply do:
- Go to System Management -> System Admin -> System Settings
- Click on the Template Settings tab.
- Look for Frontpage Link (When logged out) and Frontpage Link (When logged in).
- Change this to the menu item you created and that you want to be your home page respectively.
Creating a url to a menu item
You would obviously want to be able to create links to your other menu items throughout your development. Note that SEF urls will be converted automatically using below methods.
The old method you had to know your menu id, this can be obtained from the Menu Manager after the menu is created.
// Creating a plain url link. $url = $this->navigation->load_page(4352435632); // Will return url : example2.html // To add $_GET variables you can... $url = $this->navigation->load_page(4352435632, 'id=25'); // Will return url : example2.html?id=25
Since 2.8.2 it is easier to create a url, remember urls gets converted to their correct sef url automatically;
// Creating a plain url link. $url = $this->navigation->purl('DummyPlugin/samples/sample2.php'); // Will return url : example2.html // To add $_GET variables you can... $url = $this->navigation->purl('DummyPlugin/samples/sample2.php', 'id=25'); // Will return url : example2.html?id=25
To load the url of the active page you can simply do:
// Creating a plain url of current active page. $url = $this->navigation->self_url(); // Will return url you are on.
You can also redirect a user to another page with:
// Creating a plain url link. $url = $this->navigation->purl('DummyPlugin/samples/sample2.php'); // Will return url : example2.html // To add $_GET variables you can... $this->navigation->redirect($url, 3); // Will redirect in 3 seconds.
Documentation will follow soon
- ->navigation
- show_menu ($hide_type, $menu_id = false)
- generic_button ($name, $url = false)

