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:

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

Allowing Scripts in the HTML Editor

Go to End

3 Posts   1903 Views


Community Member, 1 Post

14 June 2011 at 5:12am

Hi All,

I'm extremely new to php and SS CMS!

I am having trouble getting some scripts to work (which I am transferring from my old html website).
I have searched the forum for solutions, and so far have found that I should edit mysite/config.php to include:


However, my script still won't work as the CMS seems to place comments bewteen scripts with <![CDATA[ as shown here:

<script type="text/javascript" src="">// <![CDATA[
<script type="text/javascript">[CDATA[<![CDATA[<![CDATA[<![CDATA[// <![CDATA[
var so = new SWFObject("", "PictoBrowser", "940", "590", "8", "#3a3a3a"); so.addVariable("source", "album"); so.addVariable("userName", "user"); so.addVariable("names", "101125"); so.addVariable("albumId", "0000000123"); so.addVariable("titles", "off"); so.addVariable("displayNotes", "off"); so.addVariable("thumbAutoHide", "off"); so.addVariable("imageSize", "original"); so.addVariable("vAlign", "mid"); so.addVariable("vertOffset", "0"); so.addVariable("colorHexVar", "3a3a3a"); so.addVariable("initialScale", "off"); so.addVariable("bgAlpha", "5"); so.write("PictoBrowser110419211155");
// ]]]]]]]]<![CDATA[><![CDATA[><![CDATA[><![CDATA[>]]]]]]<![CDATA[><![CDATA[><![CDATA[>]]]]<![CDATA[><![CDATA[>]]]][CDATA[
// --&gt;]]></script>

Does anybody have any ideas????

Many thanks!!!


Community Member, 36 Posts

27 January 2012 at 4:43am

Edited: 27/01/2012 4:44am

I know this is a old post, but i just had the same problem and found a (rather) hacky solution:

Add this to your Page.php inside the Page Class.

public function onBeforeWrite(){
			$searchFor = array(
			$this->RawContext = str_replace($searchFor, '', $this->RawContext);

My field is "RawContext" where i used some javascript.

You should "clean" all the CDATA Tags from the field first. Then the onBeforeWrite will filter those new added tags out.



Community Member, 20 Posts

1 February 2012 at 3:29am

Edited: 01/02/2012 3:33am

I have had similar problem with <script type="text/javascript" src+"url" statement

Did you add this to the Page.php file at mysite/code/Page.php?

Also re RawContext, what is this?

Any help gratefully received. I have tried a number of suggestions on the forum but so far none have worked. I need to be able to find a way to use <script type="text/javascript" src+"url" statement.

If I can't do this then I will have to look at an alternative cms which would be a shame because in every other regard Silverstripe seem to be just what I need.