Nee daran lag es leider auch nicht.
die <br />'s werden gelöscht... hab das mal mit nem str_replace getestet... :/
Gästebuch_template
Re: Gästebuch_template
There are 10 types of people in the world: Those who understand binary and those who don't
Re: Gästebuch_template
Hallo,
das ist nicht ganz so einfach, da die Renderreihenfolge [PHP] und Template genauer betrachtet werden muss. Der Template Renderer schmeißt alle HTML-Tags raus.
Anderseits generiert er kein <br> in dem innerhalb von [PHP] angesteuerten Tag {MSG} (Funktion: nl2br ( string $string [, bool $is_xhtml= true ] ))
Also muss die ganze Sache ausgetrickst werden. Das sollte so funktionieren (nicht getestet).
Template
Einfacher Ersetzer der zu vor eingefügten Marken <!--MSG_OBEN//--> ... <!--MSG_UNTEN//-->
In /frontend_init/my_trigger.php
Knut
das ist nicht ganz so einfach, da die Renderreihenfolge [PHP] und Template genauer betrachtet werden muss. Der Template Renderer schmeißt alle HTML-Tags raus.
Anderseits generiert er kein <br> in dem innerhalb von [PHP] angesteuerten Tag {MSG} (Funktion: nl2br ( string $string [, bool $is_xhtml= true ] ))
Also muss die ganze Sache ausgetrickst werden. Das sollte so funktionieren (nicht getestet).
Template
Code: Select all
[MSG]
<p>
[PHP]if('{EMAIL}' == 'xxx at xxx dot de') { echo '<!--MSG_OBEN//-->'; }[/PHP]
{MSG}
[PHP]if('{EMAIL}' == 'xxx at xxx dot de') { echo '<!--MSG_UNTEN//-->'; }[/PHP]
</p>
[/MSG]
In /frontend_init/my_trigger.php
Code: Select all
<?php
// http://forum.phpwcms.org/viewtopic.php?p=107107#p107107
/* ------------------------------------------------------------------
function cp_trigger_function_name($param1, & $param2) {
if($param2['acontent_type'] == 14) { // 14 is CP WYSIWYG
$param1 = do_this_or_that($param2['acontent_id']);
}
return $param1;
}
* cp_trigger_function_name - the unique function name
* $param1 - holds the content part html source on which you can parse or do custom processing
* $param2 - is a reference to an array which holds content part values like ID, dates and other values - see db table phpwcms_articlecontent
Always return $param1;
*/
// ------------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); }
// ------------------------------------------------------------------
function CP_GUESTBOOK_wrap_MSG($text, & $data) {
if($data['acontent_type'] == 18) { // 29 is CP guestbook
$text = preg_replace('/\<!--MSG_OBEN\/\/--\>(.*?)\<!--MSG_UNTEN\/\/--\>/is', '<span style="color:#D48F08">$1</span>', $text);
}
return $text;
}
register_cp_trigger('CP_GUESTBOOK_wrap_MSG');
?>
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )