This is an old revision of the document!


Navi-Row replacement

Certain lines of a navigation replaced by another content.

FIXME translate

With this RT you are able to replace identified rows in a navigation (NAV_LIST_UL) with specified content from the script. The cement lines or categories are determined by an entry in the field CLASS-defined in category.

This is for example useful when a blank line is required in a vertical navigation.

Source:

<ul>
    <li class="sub_parent">                <a href="index.php?index" title="Home">Home</a></li>
    <li class="sub_no sub_first separator">Tzzz Tzzz</li>
    <li class="sub_no">                    <a href="index.php?category01" title="Category01">Category01 Lang</a></li>
    <li class="sub_no">                    <a href="index.php?category02" title="Category02">Category02</a></li>
    <li class="sub_no separator">          Tzzz Tzzz</li>
    <li class="sub_no">                    <a href="index.php?category03" title="Category03">Category03</a></li>
    <li class="sub_no">                    <a href="index.php?category04" title="Category04">Category04</a></li>
</ul>



rt_nav_link_replace.php V1.0 30.09.11

Docu: –
Forum: Re: Navigations Menü

Author: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.47
Version: V1.0

TAG: –

filename: rt_nav_link_replace.php

Folder: template/inc_script/frontend_render/

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

  • $phpwcms['allow_ext_render'] = 1;



Description

Highlight the NAVI to search in the template with the identifiers <!--NAVI01_START/END-->

<!--NAVI01_START-->{NAV_LIST_UL:P,0....}<!--NAVI01_END-->

(for short runtime)


View ADMIN -> Site structure

Insert in Site structure -> category in the field CSS class: the name of the class, in this example: “separator”.
(The text in the “category title” is arbitrary and is merely for a better overview on the point ADMIN. The entry in “alias tihs category” also has no relevance, but may not be duplicated throughout the system.)

In Sript under --- CUSTOM --- enter the same class, in this case

$class = 'separator';


In Script under --- CUSTOM --- enter the replacing syntax, in this case e.g.:

$replacer = '<div style="width:80px;display:block;border:1px solid gray;color:gray">Tzzz&nbsp;Tzzz</div>';


<note> Everything between <li class=".....$class"> and the next </ li> will be replaced by the string from the var $replacer. </note>

Example

From the original:

<!--NAVI01_START-->
<ul>
    <li class="sub_parent">               <a href="index.php?index"      title="Home">Home</a></li>
    <li class="sub_no sub_first separator"><a href="index.php?trenner-1"  title="--- separator">--- separator</a></li>
    <li class="sub_no">                   <a href="index.php?category01" title="Category01 Lang">Category01 Lang</a></li>
    <li class="sub_no">                   <a href="index.php?category02" title="Category02">Category02</a></li>
    <li class="sub_no separator">         <a href="index.php?trenner-2"  title="--- separator">--- separator</a></li>
    <li class="sub_no">                   <a href="index.php?category03" title="Category03">Category03</a></li>
    <li class="sub_no">                   <a href="index.php?category04" title="Category04">Category04</a></li>
</ul>
<!--NAVI01_END-->

wird mit dem unten angegebenen Script:

<ul>
    <li class="sub_parent">                <a href="index.php?index"      title="Home">Home</a></li>
    <li class="sub_no sub_first separator"><div style="border: 1px solid gray; width: 80px; display: block; color: gray;">Tzzz&nbsp;Tzzz</div></li>
    <li class="sub_no">                    <a href="index.php?category01" title="Category01 Lang">Category01 Lang</a></li>
    <li class="sub_no">                    <a href="index.php?category02" title="Category02">Category02</a></li>
    <li class="sub_no separator">          <div style="border: 1px solid gray; width: 80px; display: block; color: gray;">Tzzz&nbsp;Tzzz</div></li>
    <li class="sub_no">                    <a href="index.php?category03" title="Category03">Category03</a></li>
    <li class="sub_no">                    <a href="index.php?category04" title="Category04">Category04</a></li>
</ul>


Code

rt_nav_link_replace

<?php
/*******************************************************************************
 Replacing the link of a navigation point in NAV_LIST_UL generated navigations
 V1.0  30.09.11 K.Heermann (flip-flop)
 
 - The navi area to be searched is marked with:
   <!--NAVI01_START-->{NAV_LIST_UL:P,0....}<!--NAVI01_END-->
 
 - Put in the same class name in "site structure -> CSS class:"
   and further down in the customer area ($class).
 - Put in the part that is to be inserted ($replacer).
 
 Everything between <li class=".....$class"> and the next </ li> is replaced
 by the Replacer
 
********************************************************************************/
 
// -----------------------------------------------------------------------------
// obligate check for phpwcms constants
  if (!defined('PHPWCMS_ROOT')) {
    die("You Cannot Access This Script Directly, Have a Nice Day.");}
// -----------------------------------------------------------------------------
 
 
if (strpos($content['all'], '<!--NAVI01_START-->')) {
 
    // ------ CUSTOM ---------
    $class         = 'separator';
    $replacer     = '<div style="width:80px;display:block;border:1px solid gray;color:gray">Tzzz&nbsp;Tzzz</div>';
 
 
 
    // Catch the NAVI01 area
    preg_match_all('/\<!--NAVI01_START--\>(.*?)\<!--NAVI01_END--\>/ism',$content['all'], $navi);
 
    if ($navi[1][0]) {  // is there any content?
 
        // Find the lines and replace the content
        $navi[1][0] = preg_replace('/\<li class="(.*?)'.$class.'"\>(.*?)\<\/li\>/ism','<li class="$1'.$class.'">'.$replacer.'</li>',$navi[1][0]);
 
        // Insert back into html source
        $content['all'] = preg_replace('/\<!--NAVI01_START--\>(.*?)\<!--NAVI01_END--\>/ism',$navi[1][0],$content['all']);
 
    }
}
// -----------[ CLOSE ]----------------
?>


english/phpwcms_replacer_rts/frontend_render/navi-row-replacement.1317463881.txt.gz · Last modified: 2018/06/03 18:08 (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