本文整理汇总了PHP中Frontend\Core\Engine\Navigation::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::getUrl方法的具体用法?PHP Navigation::getUrl怎么用?PHP Navigation::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend\Core\Engine\Navigation
的用法示例。
在下文中一共展示了Navigation::getUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param KernelInterface $kernel
*/
public function __construct(KernelInterface $kernel)
{
parent::__construct($kernel);
// store in reference
$this->getContainer()->set('breadcrumb', $this);
// get more information for the homepage
$homeInfo = Navigation::getPageInfo(1);
// add homepage as first item (with correct element)
$this->addElement($homeInfo['navigation_title'], Navigation::getURL(1));
// get other pages
$pages = $this->URL->getPages();
// init vars
$items = array();
$errorURL = Navigation::getUrl(404);
// loop pages
while (!empty($pages)) {
// init vars
$URL = implode('/', $pages);
$menuId = Navigation::getPageId($URL);
$pageInfo = Navigation::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 = Navigation::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']);
}
}