Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Output Text without encoding HTML characters


Go to End


3 Posts   2841 Views

Avatar
MarijnKampf

Community Member, 176 Posts

12 May 2010 at 2:36am

I've recently upgraded one of my clients to version 2.4, but I failed to notice an issue when testing.

Pre version 2.4 I could have a variable of the type Text output it's content in a template, in version 2.4 its output is automatically HTML encoded. I can't use HTMLText as this seems to break things. Is there a way to disable the automatic HTML encoding of a Text field?

Avatar
moondance

Community Member, 1 Post

14 July 2010 at 3:09am

HTML-Encoding is disabled for ContentController functions. So if you want to pass unencoded values to the template, just create a proxy function in the ContentController.

Avatar
mkval

Community Member, 3 Posts

22 August 2010 at 6:54am

That's true. Inside your function, you can make use of

html_entity_decode()
to turn back the markups.