NAVIGATION
This shows you the differences between two versions of the page.
deutsch:navigationen:dropdown_flyout:nav_vert_fo [2010/04/27 11:14] Knut Heermann (flip-flop) |
deutsch:navigationen:dropdown_flyout:nav_vert_fo [2019/12/25 16:56] (current) Uwe Tholey |
||
---|---|---|---|
Line 269: | Line 269: | ||
?> | ?> | ||
</code> | </code> | ||
+ | \\ | ||
+ | |||
+ | ==== NAV_VERT_FO für PHP 7.x ==== | ||
+ | <code php|h rt_nav_vert_fly_out.php |h> | ||
+ | <?php | ||
+ | |||
+ | //error_reporting(E_ALL); ini_set('display_errors', 1); | ||
+ | |||
+ | // ************************************************************************** | ||
+ | // 08.11.07 vertical fly-out with ID output -> NAVI VERTICAL FLY-OUT | ||
+ | // Oliver Georgi | ||
+ | // http://www.phpwcms.de/forum/viewtopic.php?p=89743#89743 | ||
+ | // 08.11.07 KH (flip-flop) Enhanced: Start[ID] {NAV_VERT_FO:ID} | ||
+ | // 08.05.08 KH (flip-flop) Enhanced: Level depth {NAV_VERT_FO:ID,Depth} | ||
+ | // TAG [horizontal]: http://www.phpwcms.de/forum/viewtopic.php?p=89743#89743 | ||
+ | // TAG [vertical]: http://forum.phpwcms.org/viewtopic.php?p=103442#p103442 | ||
+ | // | ||
+ | // TAG: {NAV_VERT_FO:ID,Depth} | ||
+ | // Location: Put it into the file e.g.: | ||
+ | // /template/inc_script/frontend_render/rt_nav_vert_fly_out.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_VERT_FO') == false)) { | ||
+ | $content["all"] = str_replace('{NAV_VERT_FO}', '{NAV_VERT_FO:0,100}', $content["all"]); | ||
+ | $content["all"] = preg_replace('/\{NAV_VERT_FO:([0-9]+?)\}/', '{NAV_VERT_FO:$1,100}', $content["all"]); | ||
+ | $content["all"] = preg_replace_callback('/\{NAV_VERT_FO:(.*?),(.*?)\}/', 'callback_buildNavi_vert', $content["all"]); | ||
+ | } | ||
+ | // $content['all'] = str_replace('{NAVI}', buildNavi(), $content['all']); | ||
+ | |||
+ | function callback_buildNavi_vert($match) { | ||
+ | return buildNavi_vert($match[1], 0, $match[2]-1); | ||
+ | } | ||
+ | |||
+ | function buildNavi_vert($start = 0, $counter = 0, $depth = 0) { | ||
+ | |||
+ | $start = intval($start); | ||
+ | $depth = intval($depth); | ||
+ | |||
+ | $t = array(); | ||
+ | $struct = getStructureChildData($start); // Catch structure | ||
+ | $last = $counter ? 0 : count($struct) - 1; | ||
+ | $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_vert($value['acat_id'], $counter + 1, $depth); | ||
+ | } else { | ||
+ | $s = ''; | ||
+ | } | ||
+ | // -- <D01> ------------------------------------------------------------------- | ||
+ | if ($s) { | ||
+ | $g = '<!--[if IE 7]><!--></a><!--<![endif]-->'; | ||
+ | $g .= $s; | ||
+ | $g .= LF . str_repeat(' ', $counter); | ||
+ | |||
+ | //$class = $counter ? (' class="fly_ul '.$a1.'"') : (' class="sub_ul '.$a1.'"'); // Second level with activ category | ||
+ | $class = $counter ? (' class="fly_ul"') : (' class="sub_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="vert_enclose"'; | ||
+ | } | ||
+ | elseif ($x || ($counter == 0 && $x == 0)) { | ||
+ | $enclose = ''; | ||
+ | } | ||
+ | else { | ||
+ | $enclose = ' class="vert_enclose"'; | ||
+ | } | ||
+ | |||
+ | // IDs for every li ======= If you need the ID class, please uncomment/comment | ||
+ | // IDs fuer jedes li ======= Wenn sie die ID Klassen benötigen, 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>' . 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>'; | ||
+ | |||
+ | // added simple [br] -> <br /> | ||
+ | $search[25] = '/\[br\]/i'; $replace[25] = '<br />'; | ||
+ | // ========== end copy&paste ======== | ||
+ | |||
+ | $t = preg_replace($search, $replace, $t); | ||
+ | |||
+ | // -- <E01> ------------------------------------------------------------------- | ||
+ | */ | ||
+ | |||
+ | return $t; | ||
+ | } | ||
+ | ?> | ||
+ | </code> | ||
+ | \\ | ||
+ | |||
+ | ==== Images ==== | ||
+ | Dateinamen: **sub.gif, shade.gif, transparent.gif** | ||
+ | |||
+ | Ort: **/img/article/navi/ ** | ||
+ | |||
+ | {{:deutsch:navigationen:dropdown_flyout:navi_img.zip|}} | ||
+ | |||
==== CSS ==== | ==== CSS ==== |