Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Adding a script into a page

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

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

Page: 1
Go to End
Author Topic: 5176 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Adding a script into a page Link to this post

    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>

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: Adding a script into a page Link to this post

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

  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Re: Adding a script into a page Link to this post

    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.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Adding a script into a page Link to this post

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

  • BigB
    Avatar
    Community Member
    9 Posts

    Re: Adding a script into a page Link to this post

    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.

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