Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
WRAP_SHOW_CONTENT [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

WRAP_SHOW_CONTENT

A enhanced SHOW_CONTENT wrapped in a container.
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.
- 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.:
{WRAP_SHOW_CONTENT:CP, 19:my_class}
or without a class
{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

{WRAP_SHOW_CONTENT:...:class}

<?php
// ==================================================================
// {WRAP_SHOW_CONTENT:...:class}. The same like {SHOW_CONTENT: ...
// but with a enclosed div container
// If there is/are a unfilled or unvisible CP/CPs no output is generated
// (and no div wrapper)
//
// E.g.: {WRAP_SHOW_CONTENT:CP, 19: my_class}
//    or {WRAP_SHOW_CONTENT:CP, 19}  -> fallback default class
//
// Default class: WRAP_SHOW_CONTENT
//
// file name: /template/inc_script/frontend_render/rt_wrap_show_content.php
// forum: http://forum.phpwcms.org/viewtopic.php?p=110898#p110898
//
// (c) 07.11.08 Knut Heermann (flip-flop) http://planmatrix.de
//     08.11.08 Updated for a better handling
//     11.01.11 Update parse SHOW_CONTENT a second time
// ==================================================================
// ------------------------------------------------------------------
// 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_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
        if (!empty($phpwcms["allow_cntPHP_rt"]))
            $string = render_PHPcode($string);
 
        // parses all system RTs
        $string = html_parser($string);
 
        // Special for eMail mailto:....
        if ( ($phpwcms["allow_ext_render"]) AND (strpos($string, 'mailto:') != false) ) {
 
           // try to include custom functions and replacement tags or what you want to do at this point of the script
           // default dir: "phpwcms_template/inc_script/frontend_render"; only *.php files are allowed there
           if ( is_file(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php') ) {
 
              include_once(PHPWCMS_TEMPLATE.'inc_script/frontend_render/makeEmailSpamSave.php');
              $string = replaceEmailAddress($string);
           }
        }
 
        // Set the wrapper around
        if (!$string == '') { $my_replace  = $div_before.$string.$div_behind; }
        else { $my_replace = ''; }
 
    return $my_replace;
}
 
// And do it ======
$content["all"] = preg_replace('/{WRAP_SHOW_CONTENT:(.*?)}/e', 'func_wrap_show_content("$1")', $content["all"]);
 
}
?>
english/phpwcms_replacer_rts/frontend_render/wrap_show_content.txt · Last modified: 2011/01/21 11:28 by Knut Heermann (flip-flop)
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

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79