NAVIGATION
This shows you the differences between two versions of the page.
|
english:navigation:dropdown-flyout:nav_horiz_dd [2009/05/05 10:20] 127.0.0.1 external edit |
english:navigation:dropdown-flyout:nav_horiz_dd [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ====== NAV_HORIZ_DD:ID,Level depth ====== | ====== NAV_HORIZ_DD:ID,Level depth ====== | ||
| - | **A horizontal navigation usding a drop-down mechanism.** No JS in use! | + | **A horizontal navigation using a drop-down mechanism.** No JS in use! |
| - | A modificated navigation of O.G.s O.G.s [[http://www.phpwcms.de/forum/viewtopic.php?p=89743#89743|{NAVI}]]. //(Very impressive).// I say, this is the navigation you should prefer instead of the NAV_LIST_UL:HCSS. \\ | + | A modified navigation of O.G.s O.G.s [[http://www.phpwcms.de/forum/viewtopic.php?p=89743#89743|{NAVI}]]. //(Very impressive).// I say, this is the navigation you should prefer instead of the NAV_LIST_UL:HCSS. \\ |
| The original edition from Stu Nicholls you will find here: \\ | The original edition from Stu Nicholls you will find here: \\ | ||
| [[http://www.cssplay.co.uk/menus/simple_vertical.html|A simple six level drop-down menu with overlap and overrun]] -> **Please respect the Copyright** :!: | [[http://www.cssplay.co.uk/menus/simple_vertical.html|A simple six level drop-down menu with overlap and overrun]] -> **Please respect the Copyright** :!: | ||
| Line 15: | Line 15: | ||
| Forum: [[http://forum.phpwcms.org/viewtopic.php?t=16080]] | Forum: [[http://forum.phpwcms.org/viewtopic.php?t=16080]] | ||
| - | **Autor:** K.Heermann (flip-flop) http://planmatrix.de //(05.05.09)// \\ | + | **Author:** K.Heermann (flip-flop) http://planmatrix.de //(05.05.09)// \\ |
| **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.01 //04.09.2010// \\ | ||
| + | - The link "Home" can either be presented (In the PHP script on/off). | ||
| Line 27: | Line 29: | ||
| * Overlap and Overrun !!! | * Overlap and Overrun !!! | ||
| * Start-ID im RT | * Start-ID im RT | ||
| - | * Level depth in rt (since 28.04.08) (Only php file changed) | + | * Level depth in rt //(since 28.04.08)// //(Only php file changed)// |
| * active path for the first level | * active path for the first level | ||
| - | * every li has it´s own class (optional) | + | * every li has it´s own class //(optional)// |
| + | * Home can be shown //(optional in V1.1 since 04.09.10)// | ||
| * simple Tags in category headline like [i] [b] [u] [s] | * simple Tags in category headline like [i] [b] [u] [s] | ||
| Line 36: | Line 39: | ||
| ---- | ---- | ||
| \\ | \\ | ||
| + | |||
| + | |||
| + | ==== Installation: ==== | ||
| + | |||
| + | - Copy the two snippets into their respective files // (must be created)// \\ | ||
| + | - /template/inc_script/frontend_render/rt_nav_horiz_drop_down.php | ||
| + | - /template/inc_css/nav_horiz_drop_down.css | ||
| + | - Insert the tag into the template at the preferred place, where the menu is to appear | ||
| + | * E.g.: <div id="menu_container">{NAV_HORIZ_DD:0,4}</div> | ||
| + | - Merge the CSS file into the layout | ||
| + | * ADMIN -> template -> select css-file: [nav_horiz_drop_down.css] //(Multiple choice also <Strg> left mouse button)// | ||
| + | - Set up the tag //(Beginning ID and level depth which can be represented)// | ||
| + | * E.g. {NAV_HORIZ_DD:2,5} //(Beginning in the level with the ID 2, representation of max. 5 levels depth)// | ||
| + | - adapt the css file | ||
| + | |||
| + | ---- | ||
| + | |||
| + | \\ | ||
| + | |||
| ==== TAG ==== | ==== TAG ==== | ||
| - | **{NAV_HORIZ_DD:ID,Level depth}** -> z.B. //Output beginning in level 0 (home/root) with level depht limitation of 2.// | + | **{NAV_HORIZ_DD:ID,Level depth}** -> e.g. //Output beginning at level 0 (home/root) with level depht limitation of 2.// |
| <code html><div id="menu_container">{NAV_HORIZ_DD:0,2}</div></code> | <code html><div id="menu_container">{NAV_HORIZ_DD:0,2}</div></code> | ||
| Line 46: | Line 68: | ||
| {{:deutsch:navigationen:dropdown_flyout:nav_horiz_dd_id_01.gif|NAV_HORIZ_DD:ID,Level-depth}} | {{:deutsch:navigationen:dropdown_flyout:nav_horiz_dd_id_01.gif|NAV_HORIZ_DD:ID,Level-depth}} | ||
| + | Given structure in this example: | ||
| + | |||
| + | <code> | ||
| + | - root (index.php ID=0) | ||
| + | --- Home | ||
| + | --- Ebene01 | ||
| + | --- Ebene02 | ||
| + | --- Ebene03 | ||
| + | --- Ebene04 | ||
| + | --- Ebene05 | ||
| + | </code> | ||
| + | ** | ||
| + | V1.0:** | ||
| + | * There is a redirect for the **root** article to ** home ** //(permanently 301)//. \\ | ||
| + | * Redirecting to [index.php?home] | ||
| + | |||
| + | |||
| + | **V1.01:** | ||
| + | * Redirecting from **root** to **home** isn´t necessary, because by editing (//%%==== Custom var ====%%)// around line 36 of the script you can turn on/off the link \\ Generated code: ##%%<li id="cat-id_0" class="drop home"><a class="first" href="....%%## \\ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | \\ | ||
| - | ==== PHP ==== | + | ==== PHP V1.0 ==== |
| Filename: **rt_nav_horiz_drop_down.php** | Filename: **rt_nav_horiz_drop_down.php** | ||
| Line 91: | Line 136: | ||
| 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 = ''; | ||
| + | } | ||
| + | // ========================== | ||
| + | |||
| + | // -- <D01> ------------------------------------------------------------------- | ||
| + | // Preset level depth added | ||
| + | // Ebenetiefenvorgabe hinzugefuegt | ||
| + | // $s = buildNavi_horiz($value['acat_id'], $counter+1); | ||
| + | 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; | ||
| + | |||
| + | $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 | ||
| + | |||
| } else { | } else { | ||
| $last = 0; | $last = 0; | ||
| Line 129: | Line 367: | ||
| // -- <D01> ------------------------------------------------------------------- | // -- <D01> ------------------------------------------------------------------- | ||
| if($s) { | if($s) { | ||
| - | $g = '<!--[if IE 7]><!--></a><!--<![endif]-->'; | + | $g = '<!--[if gte IE 7]><!--></a><!--<![endif]-->'; |
| $g .= $s; | $g .= $s; | ||
| $g .= LF . str_repeat(' ', $counter); | $g .= LF . str_repeat(' ', $counter); | ||
| Line 216: | Line 454: | ||
| ?> | ?> | ||
| </code> | </code> | ||
| + | |||
| + | \\ | ||
| ==== CSS ==== | ==== CSS ==== | ||