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.

General Questions /

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

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

xHTML Code Cleaning issues (iframe, script and CDATA)


Reply


3 Posts   1664 Views

Avatar
chadws

Community Member, 9 Posts

29 September 2010 at 6:15am

We have been working with SilverStripe and Really like it, but I am having issues with script and iframe tags. I was going to look into this to see if I could fix it and submit a patch, but am finding that I don't even know where to start.

The problem is that for browser compatibility the script and iframe tags can not be shortened and must have end tags. So <script src="..." /> is not valid, but <script src="..."></script> is.

I began by assuming that TinyMCE was the source of the problem, but after looking at the post messages I found that the script tag is being submitted properly. Therefore something in silverstripe appears to be cleaning up the xhtml and changing these tags.

An Example of the unencoded post data follows:

&ExtraMeta=<script type="text/javascript" language="javascript" src="/StaffDirectory/staffdirectory/staffdirectory.nocache.js"></script>

Can someone tell me what I can read to understand the flow of submitted data through the CMS. I need to know what happens when data is submitted so that I can determine what is altering these tags.

Also, in a post someone else mentions that <![CDATA[]]> tags are added around content within <script> tags, but I don't see this in the data being submitted to the server so I would assume the server is adding these as well. However, I can not find where this code is modified.

Any insight appreciated.
Thanks,
-- Chad

Avatar
Willr

Forum Moderator, 5513 Posts

29 September 2010 at 5:35pm

Perhaps try enabling (or disabling?) the ContentNegotiator class, that handles transforming xhtml - html for the core. http://api.silverstripe.org/2.4/sapphire/control/ContentNegotiator.html

Avatar
chadws

Community Member, 9 Posts

30 September 2010 at 5:24am

Edited: 30/09/2010 5:24am

OK, I am not certain that i did this correctly?

how does one go about disabling this class. I tried adding ContentNegotiator::disable(); in my mysite/_config.php script. I also, tried entering ContentNegotiator::enable(); neither changed the result.

Is there any documentation that states what methods are called to process the data from an HTMLText field when the data is submitted?

Thanks again,
-- Chad