Having the need to implement multi-level menu in which the first item in a menu is not linkable I tried to use xtoc 1.0 beta5 activating appropriate features ("li" function ner 5 that combines 3 and 4) .
- eg:
myFirstLevelItem ("categorized")
mySecondLevelItem1 ("categorized") > myThirdLevelItem1 , myThirdLevelItem2 , myThirdLevelItem3
mySecondLevelItem2 (direct link)
mySecondLevelItem3 ("categorized") > myThirdLevelItem1 , myThirdLevelItem2
mySecondLevelItem4 (direct link)
etc.
- "Home > category_myFirstLevelItem > "category_mySecondLevelItem1" > myThirdLevelItem1"
I searched the "tplfuncs.php" code and I found the "locator ()" function.
Then I analyzed the xtoc function "xlocator" that serves to eliminate string "category_ " when "home" (the first item in a menu) is defined as label.
At this point I pulled the string "category_" by the results of the standard "locator()" function conditional structure and deleted the link ( <a> ) that would point to pages that should never be displayed .
Finally I put the code in xtoc creating a "xlocator2 ()" ner 9 function which can be used together with 3, 4 (or 5 that combines 3 and 4) and I normally called it from the template.
Code: Select all
<?php echo xlocator2();?>
Code: Select all
// ( 9 ) xlocator2() function: is required for remove "category_" label from titles in the breadcrumb navigation, if "category_" is used for the first voice of some menu. Can be used in combination with function (3), (4) or (5).///
function xlocator2(){ global $title, $h, $s, $f, $c, $l, $tx, $cf; if (hide($s) && $cf['show_hidden']['path_locator'] != 'true') {return $h[$s];}if ($s == 0) {return $h[$s];} elseif ($title != '' && (!isset($h[$s]) || $h[$s] != $title)) {$t = eregi_replace('category_', '', $title);} elseif ($f != '') {return ucfirst($f);} elseif ($s > 0) {$t = ''; $tl = $l[$s];if ($tl > 1) {for ($i = $s - 1; $i >= 0; $i--) {if ($l[$i] < $tl) {$t = eregi_replace('category_', '', $h[$i]) . ' > ' . eregi_replace('category_', '', $t);$tl--;}if ($tl < 2) {break;}}}} else {return ' ';}if ($cf['locator']['show_homepage'] == 'true') {return a(0, '') . $tx['locator']['home'] . '</a> > ' . $t . (($s > 0 && $h[$s] == $title) ? $h[$s] : '');} else {return $t . (($s > 0 && $h[$s] == $title) ? $h[$s] : '');}}
If someone more experienced than me detects any inconsistency or incompatibility or possible drawbacks, of course, let me know.
Thanks