Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » <solved> HTML tags showing in the front-end

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 410 Views
  • Mauro74
    Avatar
    Community Member
    30 Posts

    <solved> HTML tags showing in the front-end Link to this post

    Hi all,

    I have a custom made list of events made with the DataObjectManager. One of the fields (Comments) is using the SimpleTinyMCEField in the CMS pop up. Everything works fine except that the HTML tags are showing in the front-end.
    Here's my code.

    PHP:

    //db fields
    static $db = array (
    'Place' => 'Varchar(255)',
    'Date' => 'Date',
    'Time' => 'Varchar(50)',
    'Comments' => 'Text',
    'Postcode' => 'Varchar(50)',
    );

    //Fields for the DOM Popup
    public function getCMSFields()
    {
    return new FieldSet(
    new TextField('Place'),
    new DatePickerField('Date','Gig Date (for example: 20/12/2010)'),
    new TextField('Time', 'Time (for example: 20.30)'),
    new SimpleTinyMCEField('Comments', 'Comments'),
    new TextField('Postcode', 'Postcode')
    );
    }

    Template code:

    <div id="event-list">
    <% control EventDetails %>
    <div class="event">
    <h3><a href="$Link">$Place</a></h3>
    <p>$Date.Nice - $Time</p>
    <p>Comments: $Comments</p>
    </div>
    <% end_control %>
    </div>

    I've tried to use Comments.XML but it didn't work, the tags still show up in the frontend.
    I was wondering if there's a way to display the HTML correctly.

    Thanks in advance!

    EDIT
    I didn't realise that I had to use

    'Comments' => 'HTMLText'

    as type of field!
    Everything sorted now!

    410 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.