For Developers

Paste Script Demo

With OpenCms 9 you can paste scripts like the Facebook "Like Button" directly into XML content editor fields, by defining a special area inside the formatter.

Define two different content areas inside of the element formatter using the ${cms.edited} variable. The part of the HTML code containing the pasted scripts will be displayed, if the page is reloaded. If the element is edited or moved, the HTML part without scripts will be displayed as alternative. In that case the user can be reminded to reload the page.

Please see the following formatter for implementation details:

/system/modules/com.alkacon.bootstrap.dev.demo/formatters/noscript-article.jsp

Facebook Like button