You are not logged in.
I have a content management system which uses Smarty. I wanted to use Xinha as the WYSIWIG editor but it kept foobarring my smarty tags.
Here's how you can protect your Smarty tags inside the editor:
First of all, you need to change XinhaCore.js line 319:
this.getHtmlMethod = 'TransformInnerHTML';
Next, you need to add two lines to this file: modules/GetHtml/TransformInnerHTML.js:
go to line 59, it currently looks like this:
/*23*/ new RegExp().compile(/(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g) //find content NOT inside script tags
You need to add a comma after the ending ")" so the line looks like:
/*23*/ new RegExp().compile(/(^|<\/script>)[\s\S]*?(<script[^>]*>|$)/g), //find content NOT inside script tags
Now, add these two lines after the above line:
/*24*/ new RegExp().compile(/(^|\{[\s\S]*?\})([\s\S]*?)(?=\{[\s\S]*?\}|$)/g),//find content NOT inside smarty tags
/*25*/ new RegExp().compile(/(^|\{\/[\s\S]*?\})[\s\S]*?(\{[^}]*}|$)/g) //find content NOT inside smarty tags
Save the files. In your browser you *must* dump the cache. In Firefox, its Tools, Clear Private Data.
Good luck!
Xinha Rocks!
The Tazz
Offline
Well, this works partially, I cant figure out why this type of code still messes up things like this:
{if count($courselist)>0}.....{/if}
it changes the > to >
Offline
well crap, theres more to it then this. I'm still trying to figure this out, if anyone has ideas please chime in.
Basically, we need to protect Smarty code just like script and comment code from being cleaned by Xinha.
Offline
The changes in your first post just define a couple of new regexps, without actually using them. You need to expand the statement that starts on line 154 (in the original source) to invoke them.
Offline