Not a bug, but....

Use GitHub to post bug reports and error descriptions for phpwcms. Describe your problem detailed!
Locked
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Not a bug, but....

Post 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...
:)
Last edited by jsw_nz on Thu 17. Aug 2006, 03:23, edited 2 times in total.
User avatar
Oliver Georgi
Site Admin
Posts: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Ähm, I really don't understand what you mean. :shock:

Or do you want to preserve replacement tags in the code content part unrendered?

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post 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
:)
User avatar
Oliver Georgi
Site Admin
Posts: 9907
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post 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
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

True to form, Oliver at his best :D
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

In the meantime - got a way to do it:

Just store the code in a new item in content array

Code: Select all

$content["code_contentpart"]
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(" ", "&nbsp;", 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

:D
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

"conf.inc.php"

Code: Select all

$phpwcms['jsw_nz_pers']           = 1;
Locked