PHPDevShell Navigation
2010-01-25 23:00:19   来源:   评论:0 点击:

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)
 

相关热词搜索:

上一篇:PHPDevShell Template modules
下一篇:PHPDevShell Core Utilities

分享到: 收藏
频道总排行
频道本月排行