Differences

This shows you the differences between two versions of the page.

english:phpwcms_replacer_rts:frontend_render:wrap_show_content [2010/04/05 18:49]
Knut Heermann (flip-flop)
english:phpwcms_replacer_rts:frontend_render:wrap_show_content [2018/06/03 18:09] (current)
Line 5: Line 5:
If there is/are a unfilled or unvisible CP/CPs no output is generated (and no div wrapper) If there is/are a unfilled or unvisible CP/CPs no output is generated (and no div wrapper)
-Update 04.04.2010 KH: Improvement over the original: [PHP-Code] in articles/CPs can be addressed with this tag. +**Update**  
 + 
 +**- 04.04.2010 KH:** Improvement over the original: [PHP-Code] in articles/CPs can be addressed with this tag. \\ 
 +**- 19.01.2011 KH:** Parsing of all system RTs, spam-mailto: Conversion for JS-email address is included.\\ 
 +**- 19.01.2011 KH:** Parsing of SHOW_CONTENT when in embedded CPs this RT appears a second time.
E.g.: \\ E.g.: \\
Line 12: Line 16:
**{WRAP_SHOW_CONTENT:CP, 19}** -> fallback to the default class //WRAP_SHOW_CONTENT// **{WRAP_SHOW_CONTENT:CP, 19}** -> fallback to the default class //WRAP_SHOW_CONTENT//
-File name: /template/inc_script/frontend_render/rt_wrap_show_content.php+**File name:** /template/inc_script/frontend_render/rt_wrap_show_content.php
Line 24: Line 28:
// //
// E.g.: {WRAP_SHOW_CONTENT:CP, 19: my_class} // E.g.: {WRAP_SHOW_CONTENT:CP, 19: my_class}
-//    or {WRAP_SHOW_CONTENT:CP, 19}  -> fallback default class +//    or {WRAP_SHOW_CONTENT:CP, 19}  -> fallback default class
// //
// Default class: WRAP_SHOW_CONTENT // Default class: WRAP_SHOW_CONTENT
Line 33: Line 37:
// (c) 07.11.08 Knut Heermann (flip-flop) http://planmatrix.de // (c) 07.11.08 Knut Heermann (flip-flop) http://planmatrix.de
//     08.11.08 Updated for a better handling //     08.11.08 Updated for a better handling
 +//     11.01.11 Update parse SHOW_CONTENT a second time
// ================================================================== // ==================================================================
// ------------------------------------------------------------------ // ------------------------------------------------------------------
Line 39: Line 44:
   die("You Cannot Access This Script Directly, Have a Nice Day."); }    die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
 +
if( strpos($content['all'], '{WRAP_SHOW_CONTENT:') !== FALSE ) { if( strpos($content['all'], '{WRAP_SHOW_CONTENT:') !== FALSE ) {
 + 
 + 
 +    function func_wrap_show_content($my_param) {
 + 
 +        $my_param = str_replace(' ','',$my_param); // kill all spaces
 + 
 +        // explode parameter for SHOW_CONTENT and the optional class name
 +        // $my_arr[0] = SHOW_CONTENT parameter
 +        // $my_arr[1] = optional own class name
 +        $my_arr = explode(":",$my_param);
 + 
 +        if (!empty($my_arr[1])) { $my_class = $my_arr[1]; }     // custom class name = yes
 +        else {$my_class = 'WRAP_SHOW_CONTENT'; }                // custom class name = no -> default name
 + 
 +        // set the wrapper code
 +        $div_before = '<div class="'.$my_class.'">'.LF;
 +        $div_behind = LF.'</div>';
 + 
 +        $string = '';
 +        $string = showSelectedContent($my_arr[0]);     // same as SHOW_CONTENT
 + 
 +        // +KH 19.01.11 parse SHOW_CONTENT a second time
 +        while (strpos($string, '{SHOW_CONTENT:') != false)
 +           $string = preg_replace('/\{SHOW_CONTENT:(.*?)\}/e', 'showSelectedContent("$1");', $string);
- +        // include external PHP script (also normal HTML snippets) or return PHP var value +KH: 04.04.2010 
- function func_wrap_show_content($my_param) +        if (!empty($phpwcms["allow_cntPHP_rt"])
-  +            $string = render_PHPcode($string); 
- $my_param = str_replace(' ','',$my_param); // kill all spaces +         
-  +        // parses all system RTs 
- // explode parameter for SHOW_CONTENT and the optional class name +        $string = html_parser($string); 
- // $my_arr[0] = SHOW_CONTENT parameter +         
- // $my_arr[1] = optional own class name +        // Special for eMail mailto:.... 
- $my_arr = explode(":",$my_param);  +        if ( ($phpwcms["allow_ext_render"]) AND (strpos($string, 'mailto:') != false) ) { 
-  +  
- if (!empty($my_arr[1])) { $my_class = $my_arr[1]; } // custom class name = yes +           // try to include custom functions and replacement tags or what you want to do at this point of the script 
- else {$my_class = 'WRAP_SHOW_CONTENT'; } // custom class name = no -&gt; default name +           // default dir: &quot;phpwcms_template/inc_script/frontend_render"; only *.php files are allowed there 
- +           if ( is_file(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php') ) { 
- // set the wrapper code +            
- $div_before = '<div class="'.$my_class.'";>'.LF; +              include_once(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php'); 
- $div_behind = LF.'</div>'; +              $string = replaceEmailAddress($string); 
-  +           } 
- $string = ''; +        } 
- $string = showSelectedContent($my_arr[0]); // same as SHOW_CONTENT +  
- +        // Set the wrapper around 
- // include external PHP script (also normal HTML snippets) or return PHP var value +KH: 04.04.2010 +        if (!$string == '') { $my_replace  = $div_before.$string.$div_behind; } 
- if(!empty($phpwcms[";allow_cntPHP_rt"]))  +        else { $my_replace = ''; } 
- $string = render_PHPcode($string); +  
-  +    return $my_replace;
- // Set the wrapper around  +
- if (!$string == '') { $my_replace  = $div_before.$string.$div_behind; }  +
- else { $my_replace = ''; } +
-  +
- return $my_replace;+
} }
 +
// And do it ====== // And do it ======
$content["all"] = preg_replace('/{WRAP_SHOW_CONTENT:(.*?)}/e', 'func_wrap_show_content("$1")', $content["all"]); $content["all"] = preg_replace('/{WRAP_SHOW_CONTENT:(.*?)}/e', 'func_wrap_show_content("$1")', $content["all"]);
 +
} }
?> ?>
</code> </code>
english/phpwcms_replacer_rts/frontend_render/wrap_show_content.1270486183.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