Remember me? forgot password | register

SilverStripe Forum

1171 Posts in 334 Topics by 320 members

Jump to:

Website Authors

If this is your first visit, you will need to register before you can post. However, you can browse all messages below.

Community » SilverStripe Forum » Website Authors » My silverstripe won't let me add HTML CODE!
Page: 1 go to end Reply
Author Topic: My silverstripe won't let me add HTML CODE! 972 views
  • SparxDesign
    avatar
    Community Member
    14 posts

    My silverstripe won't let me add HTML CODE! Link to this post

    Hey guys,

    Just posting up as having trouble getting html code into the website, I just want to add a Weather Forecast link, but I can't seem to do it!!

    http://www.mountbowls.co.nz/blog/

    I installed the html widget and it won't let me add any html at all, also I added the script directly using the HTML CODE part of the WYSIWYG editor but it didn't work either!

    Can somebody please help me - I appreciate it.

    Cheers
    Sheldon

  • willr
    avatar
    Core Development Team
    1263 posts
    3 SilverStripe Sites 2 SilverStripe Themes

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    What is the code you are trying to add? The CMS HTML editor window only allows basic HTML. We turned off things like Javascript so you can't write that in there by default and things like iframes so you won't be able to write anything like that - (it will just strip it out)

  • SparxDesign
    avatar
    Community Member
    14 posts

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    I am trying to add

    <div style='width: 180px; height: 150px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/blue_180x150_bg.jpg ); background-repeat: no-repeat; background-color: #346797;' ><div style='height: 138px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2.asp?partner=netweather&tStyle=whteYell&logo=0&zipcode=OCN|NZ|NZ000|TAURANGA|&lang=uke&size=8&theme=blue&metric=1&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 12px; color: #FFFFFF;' ><a style='color: #FFFFFF' href='http://www.accuweather.com/world-index-forecast.asp?partner=netweather&locCode=OCN|NZ|NZ000|TAURANGA|&metric=1' >Weather Forecast</a> | <a style='color: #FFFFFF' href='http://www.accuweather.com/maps-satellite.asp' >Weather Maps</a></div></div>

    I need it for my client :)

  • willr
    avatar
    Core Development Team
    1263 posts
    3 SilverStripe Sites 2 SilverStripe Themes

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    yes adding at will not work.. What you need to do is edit the SS config to allow for script tags by editing the cms/javascript/tinymce.template.js file scroll down to the bottom and there is 2 extended_valid_elements and valid_elements where you can add script and I think if you use valid_elements : "*"; it will allow everything. See http://www.silverstripe.com/extending-hacking-silverstripe-forum/flat/128480

  • SparxDesign
    avatar
    Community Member
    14 posts

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    Still didn't work, and I changed both to "*"

    But even the Blog Module that is made for html code didn't come out as html format, it came out in text format??

    Which is really weird??

  • willr
    avatar
    Core Development Team
    1263 posts
    3 SilverStripe Sites 2 SilverStripe Themes

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    The blog by default disables TinyMCE and uses BBCode (not a smart idea and I dont like that). If your using a recent version of the blog - available off dailybuilds.silverstripe.com you can use call this in your mysite/_config.php file


    BlogEntry::allow_wysiwyg_editing();

    Re the change to vaild_elements - if that doesn't work then I have no clue as thats the standard fix for tiny_mce. Make sure it hasn't cached the JS file by clearing your browser cache and visiting http://yoursite.com/admin?flush=1

  • Krato
    avatar
    Community Member
    4 posts

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    As Willr said, you have to go to cms/javascript/tinymce.template.js file scroll down to bottom and look for "extended_valid_elements". There you can add the elements/tags you would like the editor to accept.

    However, DO NOT DELETE THE DATA AND ADD AN ASTERISK SINCE THAT WON'T WORK.

    For example, if you would like to include the "style" attribute in a DIV, just add ", div[style]" at the end of "extended_valid_elements". More info can be found at:
    wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

  • FlorianH
    FlorianH's avatar
    Community Member
    30 posts

    Re: My silverstripe won't let me add HTML CODE! Link to this post

    valid_elements : "*
    • ",

    That'll work, so you don't need to add every single tag you want to use.

    EDIT: The code tag isn't displayed properly:

    valid_elements: Quote Asterik SquareBracketOpen Asterik SquareBracketClose Quote Comma

    Last edited: 30 September 2008 at 3:29am

    972 views
go to top Reply

Currently Online:

SonicHedgehog, Craig

Welcome to our latest member: sarahlynn