Involver Developer Network : editable_html
This page last changed on Oct 18, 2011 by jed.wheeler@involver.com.
OverviewUsed to insert a block of HTML or JavaScript into your template. The content will render in place in the template exactly as if you had inserted it directly. To configure an editable_html item, click the "Assets" tab in your SML editor window. This will allow you to create/edit html items. Because the editable_html wysiwig always inserts at least basic html formatting around your text you should not insert editable_html blocks directly in into JavaScript or SML fields where the html will cause errors. Instructions for inserting the text as a variable are included below. Use Case ScenariosThe main purposes of this tag are to
For example, a developer might also use this tag to pull out a chunk of code or text that they want the client to be able to edit at a later time without that client having to go through the code of the tab and risk them making edits that could jeopardize the integrity of the tab. If you want to input code directly, there is an icon on the WYSIWIG menu bar that will pop open an editor window. Using this window will allow you to bring in pre-written HTM, as well as bulky JavaScript libraries or CSS stylesheets that need to be available but which would bloat the page if you inserted them directly. By abstracting these chunks of code as assets you can insert them with a single tag, providing the functional equivalent of external CSS stylesheets and JavaScript libraries within the SML platform. This is preferable to hosting these assets externally for a number of reasons.
Caching ConsiderationsThis tag has no caching considerations. ConfigurationNote: The name should consist of only alphanumeric characters and underscore. Attributes
Context VariablesA context variable will be created corresponding to the name on the editable image tag. For example:
{% editable_html name:"my_html_item" %}
This will create a context variable called html_my_html_item. In order to call the actual text string use: {{ html_my_html_item.main_text }} Calling it this way will allow you to run in-line filters on it to modify its outputs. This is particularly useful when you want to use it to insert text into JavaScript where html formatting would break your code. Simply add the strip_html filter to the tag to remove that formatting, like so {{ html_my_html_item.main_text |strip_html }} FAQThis tag currently has no FAQ questions. Related Topics |
![]() |
Document generated by Confluence on Feb 12, 2013 09:09 |