This is an old revision of the document!


Navi-line replacement

Certain lines of a navigation replaced by another content.

FIXME translate

Mit dem RT können gekennzeichnete Zeilen in einer Navigation (NAV_LIST_UL) mit einem im Script angegebenen Inhalt ersetzt werden. die zu bearbeitende/n Zeile/n bzw. Kategorie/n wird durch einen definierten CLASS Eintrag in der Kategorie bestimmt.

Dies ist z.B. hilfreich, wenn eine Leerzeile in einer vertikalen Navi gewünscht ist.

Z.B.

<ul>
    <li class="sub_parent"><a href="index.php?index" title="Home">Home</a></li>
    <li class="sub_no sub_first trenner">Leerzeile</li>
    <li class="sub_no"><a href="index.php?category01" title="Category01">Category01</a></li>
    <li class="sub_no trenner">Leerzeile</li>
    <li class="sub_no"><a href="index.php?category02" title="Category02">Category02</a></li>
</ul>



rt_nav_link_replace.php V1.0 30.09.11

Docu: –
Forum: Re: Navigations Menü

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

Tag: –

Dateiname: rt_nav_link_replace.php

Verzeichnis: template/inc_script/frontend_render/

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

  • $phpwcms['allow_ext_render'] = 1;



Beschreibung

Markieren der zu durchsuchenden NAVI im Template mit den Kennungen <!--NAVI01_START/END-->

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

(um die Laufzeit kurz zu halten)

In der Seitenstruktur → Kategorie im Feld CSS Klasse: den Namen der Klasse eintragen, in diesem Beispiel: “trenner”.

Im Script unter --- CUSTOM --- die selbe Klasse eintragen, hier

$class = 'trenner';

Im Script unter --- CUSTOM --- die ersetzende Syntax eintragen, hier z.B.:

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


Alles zwischen <li class=".....$class"> und dem nächsten </ li> wird ersetzt durch die Zeichenfolge aus $replacer.

Beispiel

Aus dem Original:

<!--NAVI01_START-->
<ul>
    <li class="sub_parent">              <a href="index.php?index"      title="Home">Home</a></li>
    <li class="sub_no sub_first trenner"><a href="index.php?trenner-1"  title="#TRENNER#">#TRENNER#</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 trenner">          <a href="index.php?trenner-2"  title="#TRENNER#">#TRENNER#</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 trenner"><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 trenner">          <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         = 'trenner';
    $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.1317378363.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