Page 1 of 1
Not a bug, but....
Posted: Tue 15. Aug 2006, 04:57
by jsw_nz
I noticed that code contentpart is flawless in preserving code in preformatted output. However on closer inspection - I noticed that rep tags {....}
- get rendered at the end of the page generation process
- still are treated as "renderable"
Code: Select all
strpos($content["all"],.....preg_replace....{reptag}.....etc
As a result >> at best - it renders output and at worst >> throws errors...
I am guessing there is not much to do about this other than to deliberately embed illegal syntax (extra space or underscore) It was my hope to post wcms rep tag code in a 'psuedo-blog' I am deving atm. Any other ideas - no biggy - just posting this...
Posted: Tue 15. Aug 2006, 20:43
by Oliver Georgi
Ähm, I really don't understand what you mean.
Or do you want to preserve replacement tags in the code content part unrendered?
Oliver
Posted: Wed 16. Aug 2006, 02:39
by jsw_nz
Hi Oli,
Or do you want to preserve replacement tags in the code content part unrendered?
Yes, exactly - that is the idea - guessing it cannot be done - atm.
Unless code contentpart (or core) stores flag: $norender = 1;
(1) Psuedo
Code: Select all
if( ! (strpos($content["all"],'{REPTG}')===false) && $norender!=-1) {
do preg_replace stuff;
}
(2) Or....... Psuedo
Code: Select all
if( ! (strpos($content["all"],'{REPTG}')===false) ) {
do preg_replace stuff with sniff for $norender flag in pattern ;
}
Neither are optimal...only poor hacks
- and compromise other scripts, so really not good.
So right now my workaround is to simply add a space in reptag
- so that strpos does not sniff - this is ok.
Just thinking about issues of absolute perfection,
since wcms is like Mercedes Benz -hehe
Posted: Wed 16. Aug 2006, 07:26
by Oliver Georgi
Hehe both ways will not work
because replacement tag rendering is processed only once at the end of retrieve base content structure. But I have something in mind that might work.
Oliver
Posted: Wed 16. Aug 2006, 07:32
by jsw_nz
True to form, Oliver at his best
Posted: Thu 17. Aug 2006, 03:09
by jsw_nz
In the meantime - got a way to do it:
Just store the code in a new item in content array
and create reptag.php starting with a
z, since
frontend_render folder is processed alphabetically:
This does require a hack to
include/inc_front/content/cnt11.article.inc.php
Code: Select all
<?php
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// store the output in a new item in content array....
$content["code_contentpart"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
if($crow["acontent_text"]) {
$crow["acontent_text"] = str_replace(" ", " ", html_specialchars($crow["acontent_text"]));
$content["code_contentpart"] .= nl2br(div_class($crow["acontent_text"], $template_default["article"]["code_class"]));
}
// store a rep tag in main $CNT_TMP
$CNT_TMP .="[show_code]";
?>
then render at the end of the day (
snoozzz)
phpwcms_template/inc_script/frontend_render/zzz_show_code.php
Code: Select all
<?php
// CODE CONTENT_PART REPLACEMENT
if( ! (strpos($content["all"],'[show_code]')===false)) {
$content["all"] = str_replace('[show_code]', $content["code_contentpart"], $content["all"]);
}
?>
This is a hack - but works OK on my localhost
A VolksWagen solution
Posted: Thu 17. Aug 2006, 03:49
by DeXXus