[TYPO3] Breadcrumb as hierarchical <ul> [solved]
Tyler Kraft
tyler.kraft at netefficiency.co.uk
Thu Jul 17 11:44:49 CEST 2008
Hi
Glad you've gotten it working and forgive me - but couldn't you do the
same thing using a normal HMENU and entryLevel and then making use of
NO, ACT, CUR and various tmenuitem settings??
Just a thought...
Xavier Perseguers wrote:
>>> I would like to get
>>>
>>> Home
>>> level1
>>> level2
>>> current page
>>>
>>> that is
>>>
>>> <ul>
>>> <li>Home
>>> <ul>
>>> <li>level1
>>> <ul>
>>> <li>level2
>>> <ul>
>>> <li>current page</li>
>>> </ul>
>>> </li>
>>> </ul>
>>> </li>
>>> </ul>
>>> </li>
>>> </ul>
>
> A working solution:
>
> page.includeLibs.test = fileadmin/rootline.inc
> lib.breadcrumb = HMENU
> lib.breadcrumb {
> special = userfunction
> special.userFunc = user_menuFunc->makeMenuRootline
> special.entryLevel = 3
>
> 1 = TMENU
> 1.noBlur = 1
> 1.wrap = <ul> | </ul>
> 1.NO {
> stdWrap.field = title
> ATagTitle.field = nav_title // title
> wrapItemAndSub = <li> | </li>
> }
>
> 2 < .1
> 3 < .1
> 4 < .1
> 5 < .1
> 6 < .1
> 7 < .1
> 8 < .1
> }
>
>
> <?php
> class user_menuFunc {
>
> // The backReference to the mother cObj object set at call time
> var $cObj;
>
> function makeMenuRootline($content, $conf) {
>
> // Retrieve the UID of the updated page and the language
> $data = $this->cObj->parentRecord['data'];
>
> $uid = $data['uid'];
> $language = $data['_PAGES_OVERLAY'] ? $data['_PAGES_OVERLAY'] : 0;
> $entryLevel = intval($conf['entryLevel']);
>
> // Get the rootline
> $GLOBALS['TSFE']->sys_page =
> t3lib_div::makeInstance('t3lib_pageSelect');
> $rootline = $GLOBALS['TSFE']->sys_page->getRootLine($uid,'');
>
> $menuRootline = array();
> for ($i = count($rootline) - 1; $i >= $entryLevel; $i--) {
> $item = $rootline[$i];
> $page_uid = $item['uid'];
>
> // Is there a translation to be found?
> if ($language) {
> $overlay =
> $GLOBALS['TSFE']->sys_page->getPageOverlay($page_uid, $language);
> if ($overlay) $item = array_merge($item, $overlay);
> }
>
> if (count($menuRootline)) {
> $item['_SUB_MENU'] = array($menuRootline);
> }
> $menuRootline = $item;
> }
>
> return array($menuRootline);
> }
> }
> ?>
>
More information about the TYPO3-english
mailing list