Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » My silverstripe won't let me add HTML CODE!

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: 4011 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
    Forum Moderator
    5464 Posts

    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
    Forum Moderator
    5464 Posts

    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
    Forum Moderator
    5464 Posts

    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
    7 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
    Avatar
    Community Member
    33 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

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