NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:navigationen:dropdown_flyout:nav_horiz_dd [2010/09/04 07:08] Knut Heermann (flip-flop) |
deutsch:navigationen:dropdown_flyout:nav_horiz_dd [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 17: | Line 17: | ||
| **CMS-Version:** >= V1.2.8 \\ | **CMS-Version:** >= V1.2.8 \\ | ||
| **Version:** V1.0 //28.04.08// \\ | **Version:** V1.0 //28.04.08// \\ | ||
| - | **Update Version:** V1.1 //04.09.2010// \\ | + | **Update Version:** V1.01 //04.09.2010// \\ |
| - Der Link "Home" kann wahlweise dargestellt werden (Im PHP-Script ein/ausschalten). \\ | - Der Link "Home" kann wahlweise dargestellt werden (Im PHP-Script ein/ausschalten). \\ | ||
| Line 28: | Line 28: | ||
| * Überlappen und Überfahr(rahm)en !!! | * Überlappen und Überfahr(rahm)en !!! | ||
| * Start-ID im RT | * Start-ID im RT | ||
| - | * Max Leveltiefe im RT (seit 28.04.08) | + | * Max Leveltiefe im RT //(seit 28.04.08)// |
| * Aktiver Pfad wird für die erste Ebene gekennzeichnet | * Aktiver Pfad wird für die erste Ebene gekennzeichnet | ||
| - | * Jedes li hat eine eigene Klasse (optional) | + | * Jedes li hat eine eigene Klasse //(optional)// |
| - | * Home kann dargestellt werden (optional in V1.1) | + | * Home kann dargestellt werden //(optional in V1.01 seit 04.09.10)// |
| * Einfache html Tags in der Kategorieüberschrift wie [i] [b] [u] [s] | * Einfache html Tags in der Kategorieüberschrift wie [i] [b] [u] [s] | ||
| Line 79: | Line 79: | ||
| --- Ebene05 | --- Ebene05 | ||
| </code> | </code> | ||
| + | **V1.0:** | ||
| * Es wird im Artikel von **root** nach **home** weitergeleitet //(permanent 301)//. \\ | * Es wird im Artikel von **root** nach **home** weitergeleitet //(permanent 301)//. \\ | ||
| - | * Weiterleitung [index.php?home] | + | * Weiterleitung [index.php?home] \\ |
| + | |||
| + | **V1.01:** | ||
| + | * Weiterleitung von **root** nach **home** nicht notwendig, im Script kann der Link ein/ausgeschaltet werden (//in %%==== Custom var ====%%)// \\ Generierter code: ##%%<li id="cat-id_0" class="drop home"><a class="first" href="....%%## \\ | ||
| ---- | ---- | ||
| Line 86: | Line 90: | ||
| \\ | \\ | ||
| - | ==== PHP ==== | + | ==== PHP V1.0 ==== |
| Dateiname: **rt_nav_horiz_drop_down.php** | Dateiname: **rt_nav_horiz_drop_down.php** | ||
| Line 100: | Line 104: | ||
| // 08.11.07 KH (flip-flop) Enhanced: Start[ID] {NAV_HORIZ_DD:ID} | // 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} | // 28.04.08 KH (flip-flop) Enhanced: Level depth {NAV_HORIZ_DD:ID,Depth} | ||
| - | // 04.09.10 KH (flip-flop) Enhanced: Home link (enable/disable around line 40) | ||
| // http://www.phpwcms.de/forum/viewtopic.php?p=94688#94688 | // http://www.phpwcms.de/forum/viewtopic.php?p=94688#94688 | ||
| // | // | ||
| Line 131: | Line 134: | ||
| if($counter == 0) { | if($counter == 0) { | ||
| $last = count($struct) - 1; | $last = count($struct) - 1; | ||
| + | |||
| + | } else { | ||
| + | $last = 0; | ||
| + | } | ||
| + | |||
| + | $x = 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 = ''; | ||
| + | } | ||
| + | // ========================== | ||
| - | // ======== Only if you want home // Nur wenn Home gewuenscht | + | // -- <D01> ------------------------------------------------------------------- |
| - | /* | + | // Preset level depth added |
| - | $l = '<li id="cat-id_0" class="drop home">'; | + | // Ebenetiefenvorgabe hinzugefuegt |
| - | $l .= get_level_ahref(0, ' class="first"') . '<span>'. html_specialchars($GLOBALS['content']['struct'][0]['acat_name']); | + | // $s = buildNavi_horiz($value['acat_id'], $counter+1); |
| - | $l .= '</span></a></li>'; | + | if (($counter) < $depth) {$s = buildNavi_horiz($value['acat_id'], $counter+1, $depth); |
| + | } | ||
| + | else {$s = '';} | ||
| + | // -- <D01> ------------------------------------------------------------------- | ||
| + | if($s) { | ||
| + | $g = '<!--[if gte IE 7]><!--></a><!--<![endif]-->'; | ||
| + | $g .= $s; | ||
| + | $g .= LF . str_repeat(' ', $counter); | ||
| + | |||
| + | // $class = $counter ? (' class="fly_ul '.$a1.'"') : (' class="drop_ul '.$a1.'"'); // Second level with active category | ||
| + | $class = $counter ? (' class="fly_ul"') : (' class="drop_ul '.$a1.'"'); | ||
| + | |||
| + | $close_li = str_repeat(' ', $counter+1); | ||
| + | |||
| + | } else { | ||
| + | $g = '</a>'; | ||
| + | $class = ' class="sub_no"'; // If you don´t use the sub_no please change to: $class = ''; | ||
| + | // -- <P01> ------------------------------------------------------------------- | ||
| + | // 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.'"'; // Set it, it is active or not // Es ist aktiv oder nicht | ||
| + | // -- <P01> ------------------------------------------------------------------- | ||
| + | } | ||
| + | $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) . '<li'. $class . ' id="cat-id_' . $value['acat_id'] . '">'; | ||
| + | $l = str_repeat(' ', $counter+1) . '<li'. $class . '>'; | ||
| + | |||
| + | $l .= get_level_ahref($value['acat_id'], $enclose) . html_specialchars($value['acat_name']); | ||
| + | $l .= $g; | ||
| + | |||
| + | |||
| + | $l .= $close_li . '</li>'; | ||
| + | |||
| $t[] = $l; | $t[] = $l; | ||
| - | */ | + | |
| + | $x++; | ||
| + | } | ||
| + | |||
| + | if($counter) { | ||
| + | $A = LF . str_repeat(' ', $counter) . '<!--[if lte IE 6]><table><tr><td><![endif]-->'; | ||
| + | $B = LF . str_repeat(' ', $counter) . '<!--[if lte IE 6]></td></tr></table></a><![endif]-->'; | ||
| + | } else { | ||
| + | $A = ''; | ||
| + | $B = ''; | ||
| + | } | ||
| + | |||
| + | |||
| + | $t = implode(LF, $t); | ||
| + | if($t) { | ||
| + | $t = $A . LF . str_repeat(' ', $counter) . '<ul'.($counter?'':' id="pmenu"').'>' . LF . $t . LF . str_repeat(' ', $counter) . '</ul>'. $B ; | ||
| + | } | ||
| + | |||
| + | /* | ||
| + | // -- <E01> ------------------------------------------------------------------- | ||
| + | // 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] = '<i>$1</i>'; | ||
| + | $search[19] = '/\[u\](.*?)\[\/u\]/is'; $replace[19] = '<u>$1</u>'; | ||
| + | $search[20] = '/\[s\](.*?)\[\/s\]/is'; $replace[20] = '<strike>$1</strike>'; | ||
| + | $search[21] = '/\[b\](.*?)\[\/b\]/is'; $replace[21] = '<strong>$1</strong>'; | ||
| + | |||
| + | // ========== end copy&paste ======== | ||
| + | |||
| + | $t = preg_replace($search, $replace, $t); | ||
| + | |||
| + | // -- <E01> ------------------------------------------------------------------- | ||
| + | */ | ||
| + | |||
| + | return $t; | ||
| + | } | ||
| + | ?> | ||
| + | </code> | ||
| + | \\ | ||
| + | |||
| + | ==== PHP V1.01 ==== | ||
| + | Dateiname: **rt_nav_horiz_drop_down.php** | ||
| + | |||
| + | Ort: **/template/inc_script/frontend_render/ ** | ||
| + | |||
| + | |||
| + | <code php|h rt_nav_horiz_drop_down.php |h> | ||
| + | <?php | ||
| + | // ************************************************************************** | ||
| + | // Version 1.01 04.09.2010 KH | ||
| + | // 25.07.07 horizontal drop-down with ID output -> 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} | ||
| + | // 04.09.10 KH (flip-flop) Enhanced: Home link (enable/disable around line 36) | ||
| + | // http://www.phpwcms.de/forum/viewtopic.php?p=94688#94688 | ||
| + | // | ||
| + | // TAG: {NAV_HORIZ_DD:ID,Level depth} | ||
| + | // 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"]); | ||
| + | $content["all"] = preg_replace('/\{NAV_HORIZ_DD:(.*?)\}/i','{NAV_HORIZ_DD:$1,100}', $content["all"]); | ||
| + | $content["all"] = preg_replace('/\{NAV_HORIZ_DD:(.*?),(.*?)\}/e','buildNavi_horiz("$1","0","$2"-1);', $content["all"]); | ||
| + | } | ||
| + | // $content['all'] = str_replace('{NAVI}', buildNavi(), $content['all']); | ||
| + | |||
| + | function buildNavi_horiz($start=0, $counter=0, $depth=0) { | ||
| + | |||
| + | // ============ Custom var =========== | ||
| + | |||
| + | $home_link = false; // [true|false] = [enabled|disabled] | ||
| + | |||
| + | // ============ END Custom var ======= | ||
| + | |||
| + | |||
| + | $t = array(); | ||
| + | |||
| + | $struct = getStructureChildData($start); // Catch structure | ||
| + | |||
| + | if($counter == 0) { | ||
| + | $last = count($struct) - 1; | ||
| + | |||
| + | // ======== Only if you want home // Nur wenn Home gewuenscht | ||
| + | if ($home_link) { | ||
| + | $l = '<li id="cat-id_0" class="drop home">'; | ||
| + | $l .= get_level_ahref(0, ' class="first"') . '<span>'. html_specialchars($GLOBALS['content']['struct'][0]['acat_name']); | ||
| + | $l .= '</span></a></li>'; | ||
| + | $t[] = $l; | ||
| + | } | ||
| // ======= END Home | // ======= END Home | ||
| Line 266: | Line 450: | ||
| ?> | ?> | ||
| </code> | </code> | ||
| + | |||
| + | \\ | ||
| ==== CSS ==== | ==== CSS ==== | ||