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

My silverstripe won't let me add HTML CODE!


Reply


8 Posts   4500 Views

Avatar
SparxDesign

Community Member, 14 Posts

19 August 2008 at 1:33pm

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

Avatar
Willr

Forum Moderator, 5513 Posts

20 August 2008 at 10:40pm

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)

Avatar
SparxDesign

Community Member, 14 Posts

21 August 2008 at 8:58am

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 :)

Avatar
Willr

Forum Moderator, 5513 Posts

21 August 2008 at 10:59am

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

Avatar
SparxDesign

Community Member, 14 Posts

21 August 2008 at 2:24pm

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

Avatar
Willr

Forum Moderator, 5513 Posts

21 August 2008 at 5:55pm

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

Avatar
Krato

Community Member, 7 Posts

20 September 2008 at 9:13am

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

Avatar
FlorianH

Community Member, 33 Posts

30 September 2008 at 3:26am

Edited: 30/09/2008 3:29am

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