Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Were were looking at using CKEDitor to edit Smarty templates. The problem we were hitting was that it was replacing all the angle brackets and ampersands within the curly brackets, which messed everything up. This came up in a Google search so our solution should help anyone with similar issues.</p> <p>CKEditor rebuilds the HTML every time you switch to Source mode and when you save, so you need to add to the HTML <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Data_Processor" rel="nofollow">http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Data_Processor</a> htmlFilter. </p> <p>This worked for us: </p> <pre><code>//replace Form_content with whatever your editor's id is. htmlParser = CKEDITOR.instances.Form_content.dataProcessor.htmlFilter; //We don't want HTML encoding on smarty tags //so we need to change things in curly brackets htmlParser.onText = function(text) { //find all bits in curly brackets var matches = text.match(/\{([^}]+)\}/g); //go through each match and replace the encoded characters if (matches!=null) { for (match in matches) { var replacedString=matches[match]; replacedString = matches[match].replace(/&amp;gt;/g,'&gt;'); replacedString = replacedString.replace(/&amp;lt;/g,'&lt;'); replacedString = replacedString.replace(/&amp;amp;/g,'&amp;'); text = text.replace(matches[match],replacedString); } } return text; } </code></pre> <p>The onText function processes all the bits that aren't in tags or comments.</p> <p>I'd imagine you can do something similar by altering the code above - I've left it as is as I think our problems and required solutions are very similar.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload