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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[SOLVED] Content field <br /> tags render as <br> tags when viewing in browser


Go to End


2 Posts   960 Views

Avatar
SnowBoarder82

Community Member, 57 Posts

14 January 2014 at 4:37pm

Edited: 14/01/2014 4:50pm

Hi Guys,

I've got a bit of a problem occuring which is stopping my HTML from Validating.
The <br /> tags are being rendered without their self closing tags "/" when viewing the actual page in the browser (Using FF).
While in the CMS and viewing the HTML source (through the TinyMCE editor) it shows the correct closing tags, puzzling that it changes when the actual page is rendered...

Using SS3.1.2

Addition: The same thing is happening for <img> tags in the content section as well.

Any Clues?

Thank you,

Avatar
SnowBoarder82

Community Member, 57 Posts

21 January 2014 at 5:29pm

Solution: The problem is to do with the declared Doctype of my template. I had an XHTML Transitional doctype as opposed to HTML5
My assumption is that SS3+ renders (for lack of a better term) the content from htmleditor fields etc (for example the Content section) as HTML5.

HTML5 apparently accepts <br> as valid code whereas an XHTML doctype will not - http://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br

Thanks,