Page 1 of 1

CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Mon Apr 18, 2005 8:18 pm
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?

Solution found?

Posted: Tue Apr 19, 2005 3:37 pm
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!

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Tue Apr 19, 2005 3:51 pm
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.  ;)

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Thu Aug 17, 2006 8:08 pm
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?

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Sat Aug 19, 2006 3:24 am
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

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Thu Nov 16, 2006 10:06 pm
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!!

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Thu Nov 16, 2006 10:09 pm
by Dr.CSS
Did you try uninstall reinstall some times it helps when doing changes to .php...

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Thu Nov 16, 2006 10:15 pm
by mark_l_sanders
Yes I did!!

Re: CMSMS and XStandard Editor: Problem with SMARTY tags

Posted: Thu Nov 16, 2006 10:22 pm
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...