Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » xHTML Code Cleaning issues (iframe, script and CDATA)

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

Page: 1
Go to End
Author Topic: 1557 Views
  • chadws
    Avatar
    Community Member
    9 Posts

    xHTML Code Cleaning issues (iframe, script and CDATA) Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: xHTML Code Cleaning issues (iframe, script and CDATA) Link to this post

    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

  • chadws
    Avatar
    Community Member
    9 Posts

    Re: xHTML Code Cleaning issues (iframe, script and CDATA) Link to this post

    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

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