Jump to:

1153 Posts in 2568 Topics by 408 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Output Text without encoding HTML characters

Ask questions about upgrading SilverStripe to the latest version.

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

Page: 1
Go to End
Author Topic: 1614 Views
  • MarijnKampf
    Avatar
    Community Member
    164 Posts

    Output Text without encoding HTML characters Link to this post

    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?

  • moondance
    Avatar
    Community Member
    1 Post

    Re: Output Text without encoding HTML characters Link to this post

    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.

  • mkval
    Avatar
    Community Member
    3 Posts

    Re: Output Text without encoding HTML characters Link to this post

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

    html_entity_decode()

    to turn back the markups.

    1614 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.