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.

Archive

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


Reply

5 Posts   5187 Views

Avatar
steve_nyhof

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 AccuWeather.com that I have on several sites...
http://baumannbuilding.com/

<div style='width: 240px; height: 420px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/fall1_240x420_bg.jpg ); background-repeat: no-repeat; background-color: #E3B589;' ><div style='height: 405px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2.asp?partner=netweather&tStyle=normal&logo=1&zipcode=49424&lang=eng&size=12&theme=fall1&metric=0&target=_self'></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='http://www.accuweather.com/us/MI/HOLLAND/49424/city-weather-forecast.asp?partner=accuweather&traveler=0' >Weather Forecast</a> | <a style='color: #0000FF' href='http://www.accuweather.com/maps-satellite.asp' >Weather Maps</a> | <a style='color: #0000FF' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&traveler=0&zipcode=49424' >Weather Radar</a></div></div>

Avatar
Hamish

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?

Avatar
steve_nyhof

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.

Avatar
dio5

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

Avatar
BigB

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.