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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

<solved> HTML tags showing in the front-end


Go to End


816 Views

Avatar
Mauro74

Community Member, 30 Posts

3 November 2011 at 5:12am

Edited: 03/11/2011 5:26am

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!