[DOCU-141] Document MagnoliaTemplatingUtilities.decode() (...and encode() too, while you're at it) Created: 11/Apr/11  Updated: 07/May/15  Resolved: 30/Dec/14

Status: Closed
Project: Documentation
Component/s: content
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Will Scheidegger Assignee: Antti Hietala
Resolution: Outdated Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When trying to output fckEdit content in a custom STK template ${content.node} will output HTML and ${content.node?html} makes things even worse. When looking at the STK textEdit paragraph, on might find the stk.decode() method. The JavaDoc only tells us that it is deprecated and that one should use mgnl.decode() now. But that is not documented either.



 Comments   
Comment by Christian Ringele [ 30/Dec/11 ]

In STK 2.0 its now within the TemplatingFunctions.decode(Node) & encode(Node).

What it does:

  • You pass a node for html encoding or decoding.
  • The node passed is wrapped with an HTMLEscapingNodeWrapper
  • In STK the renderer automatically encodes all rendered content nodes -> html is always escaped.
    By that an author cannot break the html structure by adding a html tag into a pages title for example.
  • So for havin really html rendered, you need to decode the node itself. For example in the textImage.ftl:
    ${stkfn.decode(content).text}
Comment by Ruth Stocks [ 30/Dec/14 ]

documented at http://documentation.magnolia-cms.com/display/DOCS/Freemarker+reference#Freemarkerreference-Usefulmethods

Generated at Mon Feb 12 01:06:19 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.