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.


Our old forums are still available as a read-only archive.

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

Adding a script into a page


5 Posts   5187 Views


25 May 2008 at 5:55pm Community Member, 224 Posts

Has someone already made a widget or something to add a "script" into a page. I do not understand this. I have had other systems where I could add a module into a page (and inside a table for width) and add a script like this into a page.

This is a weather forcast script from that I have on several sites...

<div style='width: 240px; height: 420px; background-image: url( ); background-repeat: no-repeat; background-color: #E3B589;' ><div style='height: 405px;' ><script src=''></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 15px; color: #0000FF;' ><a style='font-size: 10px; color: #0000FF' href='' >Weather Forecast</a> | <a style='color: #0000FF' href='' >Weather Maps</a> | <a style='color: #0000FF' href='' >Weather Radar</a></div></div>


25 May 2008 at 8:49pm Community Member, 712 Posts

Have you tried the 'edit html' button in the CMS, or editing your site template?


26 May 2008 at 1:37am Community Member, 224 Posts

The html in the editor does not allow scripts or iframes. I have made a few iframe templates which work great. I was hoping there is something that will add a script where I want it - like I could do in the html editor, but SilverStripe does not allow this.

I'm hoping someone can help me with an existing widget and make some modifications.


26 May 2008 at 5:31am Community Member, 501 Posts

An idea might be to make a 'script' field, where you use Text as datatype and add a TextareaField to the cms?

If you call it eg $CustomScript, you could then use it in the template wherever you want, althoug of course not somewhere in $Content...


1 August 2008 at 2:19pm Community Member, 9 Posts

Have you had any success adding scripts via the cms yet? As you mention, it is very frustrating not to be able to add a simple script in the html editor. If you have been successful, please share your experience. Thank you.