本文整理汇总了PHP中FrontendNavigation::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendNavigation::getUrl方法的具体用法?PHP FrontendNavigation::getUrl怎么用?PHP FrontendNavigation::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendNavigation
的用法示例。
在下文中一共展示了FrontendNavigation::getUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Default constructor
*
* @return void
*/
public function __construct()
{
// call parent
parent::__construct();
// add into the reference
Spoon::set('breadcrumb', $this);
// get more information for the homepage
$homeInfo = FrontendNavigation::getPageInfo(1);
// add homepage as first item (with correct element)
$this->addElement($homeInfo['navigation_title'], FrontendNavigation::getURL(1));
// get other pages
$pages = $this->URL->getPages();
// init vars
$items = array();
$errorURL = FrontendNavigation::getUrl(404);
// loop pages
while (!empty($pages)) {
// init vars
$URL = implode('/', $pages);
$menuId = FrontendNavigation::getPageId($URL);
$pageInfo = FrontendNavigation::getPageInfo($menuId);
// do we know something about the page
if ($pageInfo !== false && isset($pageInfo['navigation_title'])) {
// only add pages that aren't direct actions
if ($pageInfo['tree_type'] != 'direct_action') {
// get URL
$pageURL = FrontendNavigation::getUrl($menuId);
// if this is the error-page, so we won't show an URL.
if ($pageURL == $errorURL) {
$pageURL = null;
}
// add to the items
$items[] = array('title' => $pageInfo['navigation_title'], 'url' => $pageURL);
}
}
// remove element
array_pop($pages);
}
// reverse so everything is in place
krsort($items);
// loop and add elements
foreach ($items as $row) {
$this->addElement($row['title'], $row['url']);
}
}