{{indexmenu_n>10}} ====== NAV_HORIZ_DD:Type,ID,Depth,li-id ====== ==== TAG ==== **{NAV_HORIZ_DD: Type, ID, depth, li-ID}** ##@string $parameter = "menu type, start_id, max_level_depth, id for every li"## - Menu type: H=Home on|off, P=Parent on|off - start_id: Where the output begins - max_level_depth: Where the output ends - id for ervery li: class name **Enhancements in this version:** \\ - The class **.first-level** is assigned to all links in the **first level**. \\ - If "Home" is active, in addition the class **.home** is inserted. \\ - State for the active path (link tracing) over all levels using the class **.act_path**. \\ - The active link ist marked with the class **.active**. \\ - The menu-type **H** shows "Home" with the class **.home** in the first level. \\ - The menu-type **P** also shows the **parent element** of start_id. \\ - The combination **HP** at **ID=0** P is the priority. \\ - Update 20.11.2010 KH: For each UL a level is given. \\ - Update 18.11.2011 KH: The title tag for each link can be optionally displayed. ==== Example: ==== -> Menu starts from level 0 (Home) and is limited to two levels deep, home is well spent, jedes
  • %%'')//. \\ * **Typ: H** = The level of home is also shown //(in the first level)// * **Typ: P** = The parent element is shown * **Typ: HP** = Home and the specified level //(parent item)// are shown //(at id = 0 special case -> Home as a simple parent element)// * **ID** = Start ID from the category tree * **Level-depth** = Number of layers/levels deep * **li-ID** = The partial name of the class of every
  • NAVI HORIZONTAL DROP-DOWN * Oliver Georgi * http://www.phpwcms.de/forum/viewtopic.php?p=89743#89743 * 08.11.07 KH (flip-flop) Enhanced: Start[ID] {NAV_HORIZ_DD:ID} * 28.04.08 KH (flip-flop) Enhanced: Level depth {NAV_HORIZ_DD:ID,Depth} * http://www.phpwcms.de/forum/viewtopic.php?p=94688#94688 * 05.03.10 KH (flip-flop) Enhanced: Menu type, H&P, id for every li * @string $parameter = "menu type, start_id, max_level_depth, id for ervery li" * - Menu type: H=Home on|off, P=Parent on|off * - id for ervery li: class name * * TAG: {NAV_HORIZ_DD:Menu type, Start-ID, Level depth, li id_name} * E.g.: {NAV_HORIZ_DD:H, 2, 3, id} * Location: Put it into the file e.g.: * /template/inc_script/frontend_render/rt_nav_horiz_drop_down.php * Switch in conf.inc.php: $phpwcms['allow_ext_render'] = 1; * ************************************************************************** */ // ---------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ---------------------------------------------------------------- if( ! ( strpos($content["all"],'{NAV_HORIZ_DD')==false ) ) { $content["all"] = str_replace('{NAV_HORIZ_DD}','{NAV_HORIZ_DD:,0,100}',$content["all"]); // For a simple call $content["all"] = preg_replace('/\{NAV_HORIZ_DD:(.*?)\}/e', 'buildNavi_horiz("$1");', $content["all"]); } //function buildNavi_horiz($start=0, $counter=0, $depth=0) { function buildNavi_horiz($parameter='', $counter=0, $param='string') { // ====== CUSTOM VAR ========================================== $menu_class = 'pmenu'; // Menue Klassenname $a2 = ' first-level'; // The upper level // Das erste Level $a3 = ' active'; // The active link // Der aktive Link // $a4 = ' first-entry'; // The first entry in upper level // Erster Eintrag im ersten Level // $a5 = ' last-entry'; // The last entry in upper level // Letzter Eintrag im ersten Level // ====== CUSTOM VAR ENDE ====================================== // only for the first call from extern // Nur fuer den ersten externen Aufruf if($param == 'string') { $parameter = explode(',', $parameter); // first entry a digit or sign? Only for compatibility to the older nav version // Erster Eintrag eine Zahl? Nut fuer Kompatibilität mit aeltere Navi Version if (isset($parameter[0]) AND (preg_match('/^[0-9]+$/i',$parameter[0])) ) { array_unshift ( $parameter, '' ); // Fill up array for $menu_type } $menu_type = empty($parameter[0]) ? '' : strtoupper(trim($parameter[0])); $start_id = empty($parameter[1]) ? 0 : intval($parameter[1]); $max_depth = empty($parameter[2]) ? 0 : intval($parameter[2]-1); $level_id_name = empty($parameter[3]) ? '' : trim($parameter[3]); $parent = false; // do not show parent link $home = false; // do not show home link switch($menu_type) { // show parent level too - only in first line [Parent] case 'P': $parent = true; break; // Home in the first line [Home] [Cat01] [Cat02] [Cat03] case 'HP': $parent = true; case 'H': $home = true; if($start_id == '0' AND $parent) $home = false; break; } } else { // for the inner call (recursive run) $menu_type = $parameter[0]; $start_id = $parameter[1]; $max_depth = $parameter[2]-1; $level_id_name = $parameter[3]; $parent = false; // do not show parent link $home = false; // do not show home link } // ----- System var ---------------- $t = array(); $x = 0; // --------------------------------- $struct = getStructureChildData($start_id); // Catch structure if($counter == 0) { $last = count($start_id) - 1; // ======== Only if you want the home link // Nur wenn Home gewuenscht if ($home) { // Home in the first line [Home] [Cat01] [Cat02] [Cat03] $l = '
  • '; $l .= get_level_ahref($start_id, ' class="home"') . ''. html_specialchars($GLOBALS['content']['struct']['0']['acat_name']); $l .= '
  • '; $t[] = $l; } // ======== Only if you want the parent link // Nur wenn der Eltern-Link gewuenscht if ($parent) { // Parent only in first line [Parent] $struct = array(); // clear array // Array leeren $struct[$start_id] = $GLOBALS['content']['struct'][$start_id]; } // ======== } else { $last = 0; } foreach($struct as $value) { // Is it a active path ? ======== // Ist dies der aktive Pfad ? ======== if( isset($GLOBALS['LEVEL_KEY'][ $value['acat_id'] ]) ) { $p1 = ' act_path'; } else { $s = ''; // Reset $struct $p1 = ''; } // Only if there is a sub level ======== // Nur wenn SubLevel vorhanden ist ======== if($GLOBALS['content']['cat_id'] == $value['acat_id']) { $a1 = ' act_path'; // Only for a direct call // Nur bei direktem Aufruf (FirstLevel active) $a3 = ''; // Not in use } else { // If first level isn´t active // Wenn FirstLevel nicht aktiv $a1 = $p1; $a3 = ''; } // ========================== // -- ------------------------------------------------------------------- // Preset level depth added // Ebenetiefenvorgabe hinzugefuegt // $s = buildNavi_horiz($value['acat_id'], $counter+1); $parameter[1] = $value['acat_id']; // start_id // if (($counter) < $depth) {$s = buildNavi_horiz($value['acat_id'], $counter+1, $depth, 'param_is_array'); if (($counter) < $max_depth) {$s = buildNavi_horiz($parameter, $counter+1, 'param_is_array'); } else {$s = '';} // -- ------------------------------------------------------------------- // Set the active link class // Aktive Link Classe setzen ($GLOBALS['content']['cat_id'] == $value['acat_id']) ? $a3 = ' active': $a3 = ''; if($s) { $g = ''; $g .= $s; $g .= LF . str_repeat(' ', $counter); $class = $counter ? (' class="fly_ul '.$a1.$a3.'"') : (' class="drop_ul '.$a1.$a2.$a3.'"'); // Second level with active category $close_li = str_repeat(' ', $counter+1); } else { $g = ''; // $class = ' class="sub_no'.$a1.$a3.'"'; // act_path auch im letzten activ link $class = ' class="sub_no'.$a3.'"'; // -- ------------------------------------------------------------------- // Only the first level if there is no sub level // Ausschlieszlich das erste Level wenn kein Sublevel vorhanden ist if ($counter == 0) { $class = ' class="sub_no'.$a1.$a2.'"'; // Set it, it is active or not // Es ist aktiv oder nicht // -- ------------------------------------------------------------------- } $close_li = ''; } // first li in block ======= // Erstes li im letzten Block ======= if( $last && $last == $x ) { $enclose = ' class="horiz_enclose"'; } elseif( $x || ($counter == 0 && $x == 0) ) { $enclose = ''; } else { $enclose = ' class="horiz_enclose"'; } // IDs for every li ======= If you need the ID class, please uncomment/comment // IDs fuer jedes li ======= Wenn sie die ID Klassen benoetigen, bitte dekommentieren/kommentieren // $l = str_repeat(' ', $counter+1) . ''; if ($level_id_name) $l = str_repeat(' ', $counter+1) . ''; else $l = str_repeat(' ', $counter+1) . ''; $l .= get_level_ahref($value['acat_id'], $enclose) . html_specialchars($value['acat_name']); $l .= $g; $l .= $close_li . ''; $t[] = $l; $x++; } if($counter) { $A = LF . str_repeat(' ', $counter) . ''; $B = LF . str_repeat(' ', $counter) . ''; } else { $A = ''; $B = ''; } $t = implode(LF, $t); if($t) { $t = $A . LF . str_repeat(' ', $counter) . '' . LF . $t . LF . str_repeat(' ', $counter) . ''. $B ; } /* // -- ------------------------------------------------------------------- // EDIT: 07/11/25 KH. (flip-flop) including simple Tags in category headline from the file // /include/inc_front/front.func.inc.php and the function html_parser($string) // you can copy&paste what you want. // ========== copy&paste =========== // typical html formattings $search[18] = '/\[i\](.*?)\[\/i\]/is'; $replace[18] = '$1'; $search[19] = '/\[u\](.*?)\[\/u\]/is'; $replace[19] = '$1'; $search[20] = '/\[s\](.*?)\[\/s\]/is'; $replace[20] = '$1'; $search[21] = '/\[b\](.*?)\[\/b\]/is'; $replace[21] = '$1'; // ========== end copy&paste ======== $t = preg_replace($search, $replace, $t); // -- ------------------------------------------------------------------- */ return $t; } ?> **IMPORTANT!** Please turn off the previous NAV_HORIZ_DD before using the V1.1 \\ //(rename the extend of the file or delete the file)//. Eg.: rt_nav_horiz_drop_down.php -> rt_nav_horiz_drop_down.php_ \\ ==== PHP V1.2a ==== Update 20.11.2010 KH: * Each UL is given a level. * Call with {NAV_HORIZ_DD1:.......} Update 16.12.2010 KH: * The class "sub_first" will also assigned to all first
  • . \\