CMSMS and XStandard Editor: Problem with SMARTY tags

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
dfritschy

CMSMS and XStandard Editor: Problem with SMARTY tags

Post by dfritschy »

I have begun writing an interface module to use XStandard (www.xstandard.com) as WYSIWYG editor.
Unfortunately, XStandard, in an effort to write prefect XHTML code, translates all quotes to "& q u o t ;" which turns SMARTY directives unusable:

{cms_module module="News" makerssbutton"true"}
becomes to
{cms_module module=&News& makerssbutton=&true&}

Being new to SMARTY and CMSMS, can anyone make a suggestion on where to intercept the parsing process?
dfritschy

Solution found?

Post by dfritschy »

I have found the ContentPreRenderfunction and use it to unescape the escaped quotes within SMARTY tags. Maybe a RegExp Guru can provide a more robust solution?

Code: Select all

	function ContentPreRender(&$content)
	{
	  $search = '@\{.*?\}@';
		$content = $tmp . preg_replace_callback(
		  $search, 
                  create_function(
				'$matches',
				'return str_replace( """, \'"\', $matches[0] );'
                   ),
		  $content
		);
	}

It has been a very interesting experience with CMSMS and SMARTY so far. I'm impressed by the CMSMS module architecture!
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by Ted »

Nice.  Though, I would think something like: preg_replace('\{.*?\".*?\}', '\'');, though it would probably need a modifier.  I'm sure your way is more than efficient enough, since it's only going to do it on non-cached pages.

Thanks for the kind words.  The module API really IS one of our best features...  besides the helpful community, of course.  ;)
mark_l_sanders

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by mark_l_sanders »

I notice that the latest release version still suffers from this problem: XStandard still replaces the double quotes in SMARTY tags.
Does anyone know if the beta 1.0 has a fix for this?
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by Elijah Lofgren »

mark_l_sanders wrote: I notice that the latest release version still suffers from this problem: XStandard still replaces the double quotes in SMARTY tags.
Does anyone know if the beta 1.0 has a fix for this?
It looks like it was fixed in the latest SVN version of XStandard: http://viewsvn.cmsmadesimple.org/viewsv ... d&view=rev
Fix should be in the next release of XStandard.

Hope this helps,

Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
mark_l_sanders

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by mark_l_sanders »

Hey Elijah
Not sure if I did enough, but I just downloaded the latest version (21) of the xstandard.module.php file and copied it over the current version - the problem still exists, though.
Have I missed something - do I need to do more than just replace 1 file?? There is another file - imagelibrary.config.php - that's quoted as part of the fix, but I've no idea what to do with it!!
Last edited by mark_l_sanders on Thu Nov 16, 2006 10:14 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by Dr.CSS »

Did you try uninstall reinstall some times it helps when doing changes to .php...
mark_l_sanders

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by mark_l_sanders »

Yes I did!!
mark_l_sanders

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Post by mark_l_sanders »

Found a workaround.

http://forum.cmsmadesimple.org/index.ph ... l#msg32781

You just use single quotes instead of doubles. Worked fine.

Strange behaviour w/out the workaround, tho: worked fine when viewing the site, but when editing the page the preview didn't work - same errors as before...
Last edited by mark_l_sanders on Thu Nov 16, 2006 11:30 pm, edited 1 time in total.
Locked

Return to “CMSMS Core”