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.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

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

Output Text without encoding HTML characters


Reply


3 Posts   1667 Views

Avatar
MarijnKampf

Community Member, 164 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 [url=http://www.silverstripe.org/upgrading-silverstripe/show/284033]break things[/url]. 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.