Loading the helper
$nh = Loader::helper('navigation');
Methods
getCollectionURL
Returns the URL of a collection
string getCollectionURL (Page $cObj)
$page = Page::getByPath('/path_to_page');
$nh = Loader::helper('navigation');
echo $nh->getCollectionURL($page);
Example returns: http://your-site.com/site_root/index.php/path_to_page/
getLinkToCollection
Returns a link to a page
string getLinkToCollection ( &$cObj, [ $appendBaseURL = false], [ $ignoreUrlRewriting = false], Page $cObj)
$page = Page::getCurrentPage();
$nh = Loader::helper('navigation');
echo $nh->getLinkToCollection($page);
Example returns: /site_root/index.php/about/
Arguments
$appendBaseURL
Includes BASE_URL at beginning of returned path
$ignoreUrlRewriting
Inserts index.php in returned path, even if Pretty URLs turned on
getTrailToCollection
Returns an array of collections as a breadcrumb to the current page
array getTrailToCollection (Page $c)
$nh = Loader::helper('navigation');
$breadcrumb = $nh->getTrailToCollection($c);
krsort($breadcrumb);
foreach ($breadcrumb as $bcpage) {
echo '' . $bcpage->getCollectionName() . ' > ';
}
echo $c->getCollectionName();
Example returns breadcrumb links: Home > Previous Page > Current Page
Loading Conversation