WRAP_NAV_LIST_UL

{WRAP_NAV_LIST_UL:…:level, class}

The same like {NAV_LIST_UL: ... but with a enclosed div container and included level lift. If there is a unfilled or unvisible navigation no output is generated (and no div wrapper :!:).

E.g.:

{WRAP_NAV_LIST_UL:F, 4,10, act_path, active : 0, my_class} -> output beginning at start ID 4 wrapped with my_class
{WRAP_NAV_LIST_UL:F,  ,10, act_path, active : 2, my_class} -> output beginning at level 2 wrapped with my_class
{WRAP_NAV_LIST_UL:F, 4,10, act_path, active : 0 }          -> output beginning at start ID 4 (no level lift)
{WRAP_NAV_LIST_UL:F, 4,10, act_path, active }              -> the same as above (no level lift)
{WRAP_NAV_LIST_UL:F,  ,10, act_path, active : 2 }          -> output beginning at level 2 (no wrapper class set)

Docu:
Forum: http://forum.phpwcms.org/viewtopic.php?p=111157#p111157

Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS-Version: >= V1.3.0
Version: V1.0 2008/11/08

Filename: rt_wrap_nav_list_ul.php

Folder: /template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;


{WRAP_NAV_LIST_UL:...:level, class}

<?php
/* ==================================================================
 {WRAP_NAV_LIST_UL:...:level, class}. The same like {NAV_LIST_UL: ...
 but with a enclosed div container and included level lift
 If there is no navigation, no output is generated. (and no div wrapper).
 Including a parser for simple tags like [i] [u] [s] [b] [br]
 If you need this, please uncomment around line 126 "$my_replace = local_html_parser($my_replace);"
 
 E.g.:
{WRAP_NAV_LIST_UL:F, 4,10, act_path, active : 0, my_class} -> output beginning at start ID 4 wrapped with my_class
{WRAP_NAV_LIST_UL:F,  ,10, act_path, active : 2, my_class} -> output beginning at level 2 wrapped with my_class
{WRAP_NAV_LIST_UL:F, 4,10, act_path, active : 0 }          -> output beginning at start ID 4 (no level lift)
{WRAP_NAV_LIST_UL:F, 4,10, act_path, active }              -> the same as above (no level lift)
{WRAP_NAV_LIST_UL:F,  ,10, act_path, active : 2 }          -> output beginning at level 2 (no wrapper class)
 
 Direct call NAV_LIST_UL -> function buildCascadingMenu
 No default class: wrap_nlu_navi1 ??????
 
 File name: /template/inc_script/frontend_render/rt_wrap_nav_list_ul.php
 Forum: http://forum.phpwcms.org/viewtopic.php?p=111157#p111157
 
 Basic navigation: (c) Oliver Georgi, written for phpwcms
 Enhanced by (c) 08.11.08 Knut Heermann (flip-flop) http://planmatrix.de
===================================================================== */
// ------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ------------------------------------------------------------------
 
 
 
if( strpos($content['all'], '{WRAP_NAV_LIST_UL:') !== FALSE ) {
 
    function func_wrap_nav_list_ul($my_param) {
 
//        $my_class         = 'wrap_nlu_navi1';    // default fallback class
        $my_class             = '';                             // no default fallback class
        $div_before         = '<div class';
        $div_behind         = '</div>';
 
        $my_level_lift     = false;
        $my_param             = str_replace(' ','',$my_param); // kill all spaces
 
        // explode parameter for NAV_LIST_UL and the optional level and class name
        // $my_arr[0] = NAV_LIST_UL parameter
        // $my_arr[1] = optional own level and class name
        $my_arr = explode(":",$my_param);
 
        $my_arr[0] = explode(",",$my_arr[0]);  // the NAV_LIST_UL parameter set
        // $my_arr[0][X] => nav_list_ul parameter array
 
        if (!empty($my_arr[1])) // ===== custom parameter are filled up?
        {
            $my_arr[1] = explode(",",$my_arr[1]); // cut out level and class
            // $my_arr[1][0] => level
            // $my_arr[1][1] => class
 
            // ===== level-lift parameter given?
            if (!empty($my_arr[1][0]) and ($my_arr[1][0] > 0 ) )   // level
            {
                $my_level_lift = true;  // Yes level-lift ist active
 
                // ===== level lift: is this the right level?
                if ( isset($GLOBALS['LEVEL_ID'][$my_arr[1][0]]) )
                {
                    // fill up the level
                    $my_level_id = $GLOBALS['LEVEL_ID'][$my_arr[1][0]];
 
                    // inject level lift ID into parameter string (No 2))
                    $my_arr[0][1] = $my_level_id;
                }
                else unset ($my_level_id);  // It is not the right level
            }
 
 
 
            // ===== custom class name given?
            if (!empty($my_arr[1][1]))  // custom class name
            {
                $my_class = $my_arr[1][1]; // custom class name = yes -> set it up
            }
// kh            else {$my_class = 'wrap_nlu_navi1'; }    // custom class name = no -> default name
 
        }     // =====END custom parameter are filled up?
 
// kh        else {$my_class = 'wrap_nlu_navi1'; }  // set to default ????
 
        // ===== set the parameter string for NAV_LIST_UL
        $my_nlu_set = implode (",",$my_arr[0]);
 
 
 
        // ======= set the wrapper code
 
        if (empty($my_class))     // is there any class name set??
        {
            $div_before = '';            // No class name set
            $div_behind = '';
        } else      $div_before .= '="'.$my_class.'">';     // Set your class
 
 
        // ======= catching the navigation
        $string = '';
 
        // Direct call NAV_LIST_UL -> same as NAV_LIST_UL
        $string = trim(buildCascadingMenu($my_nlu_set));
 
 
 
 
        // ======= Output: Set the wrapper around and have a look to the level id
 
        if ($string ) // is there any navi?
        {
            $my_replace  = $div_before.LF.'    '.$string.LF.$div_behind;
 
            if ( $my_level_lift  and  !isset($my_level_id) ) // level-lift is set but we are not in the right level
            {
                $my_replace = '';
            }
        }
        else     { $my_replace = ''; }  // no navi found
 
        // ----------------------------------------------------------------
        // Parsing simple Tags in link name like [i] [u] [s] [b] [br] .....
        // If you need it, please uncomment the next line
//        $my_replace = local_html_parser($my_replace);
        // ----------------------------------------------------------------
 
    return $my_replace;
    }
 
 
 
    function local_html_parser($t) {
    // ---------------------------------------------------------------------------
    // Parse the $t and replace all possible values like you see in
    // function html_parser (front.func.inc.php)
 
    //    $t = html_parser($t);
 
    // EDIT: 07/11/25 KH. (flip-flop) including simple Tags 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);
 
    return $t;
    // ---------------------------------------------------------------------------
}
 
 
// And do it ==================================================================
$content["all"] = preg_replace('/{WRAP_NAV_LIST_UL:(.*?)}/e', 'func_wrap_nav_list_ul("$1")', $content["all"]);
// ============================================================================
 
}
 
?>
english/phpwcms_replacer_rts/frontend_render/wrap_nav_list_ul.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0