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.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

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

HTML editor changes my code


Go to End
Reply


10 Posts   5326 Views

Avatar
electricbadger

Community Member, 2 Posts

25 January 2009 at 8:29am

Is is possible to stop the HTML editor changing my code?

I have edited TinyMCE to let it allow all tags. But the way it changes the code I enter is causing all sorts of problems when I want to do things like insert videos or Flash.

Appart from that Silver Stripe looks great. But this problem is driving me crazy and could be something that would make me chose another CMS!

Avatar
electricbadger

Community Member, 2 Posts

25 January 2009 at 8:44am

Ok - this is REALLY driving me crazy now!!

I inserted the following code to embed a .wmv file (hosted on a seperate stream server)....

<object id="StreamWM" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="514" height="357"><param name="autoStart" value="0">
<param name="autoSize" value="0">
<param name="ShowGoToBar" value="1">
<param name="StatusBar" value="1">
<param name="DisplayMode" value="1">
<param name="DisplaySize" value="1">
<param name="windowlessVideo" value="true">
<param name="wmode" value="transparent">
<param name="URL" value=" mms://ondemand.port.ac.uk/central/One_way_to_write_an_essay.wmv">
<embed type="application/x-mplayer2" width="514" height="357" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="mms://ondemand.port.ac.uk/central/One_way_to_write_an_essay.wmv" autosize="1" autostart="0" animationatstart="0" displaymode="1" showcontrols="1" showdisplay="0" showstatusbar="1" showtracker="1" TransparentAtStart="1" windowlessVideo=" true"></embed></object>

But SliverStripe changed it to this...
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="514" height="357"><param name="movie" value="mms://ondemand.port.ac.uk/central/One_way_to_write_an_essay.wmv" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="mms://ondemand.port.ac.uk/central/One_way_to_write_an_essay.wmv" wmode="transparent" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="514" height="357"></embed></object>

Which clearly wont work becuase it is a Windows - not a Flash video!!!

What am I missing??? How can I stop the code I insert being changed? There MUST be a way!!!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

25 January 2009 at 1:11pm

Seems like a pretty complex chunk of code to be trying to jam into the WYSIWYG editor. Stick to the basic headers, paragaphs, unordered lists, etc, and put stuff like that in the template. It really doesn't belong in the editor. That's not really what it's for. Even if it did work, you're running the risk of some frustrated client accidentally blowing the whole thing away or removing part of it.

Just thinking about it gives me a headache. Make a new template with the SWF attached to the page as a related object. Much cleaner.

Avatar
CriaturaCreativaStudio

Community Member, 73 Posts

29 March 2009 at 8:35am

I think editor or silverstripe definittely alters the code...
I've styled tags and classes on a css file to appear the way i like it.
The code i enter on the editor begins with an IMG tag... but silverstripe insists to add a <p> tag surrounding the <img> tag, and i don't want that. Can i turn off that feature? because i don't want my code to be changed, i already take care that my code looks good.

Regards

Eduardo

Avatar
shapeg

Community Member, 4 Posts

22 September 2009 at 6:57am

I am just wanting to add a simple "rel"='lighthouse' takg to the "<AREA...." code and have updated tiny_mce.js but it still won't let me. Keeps removing it. It allows the tag after a <A ...... Any ideas?

Avatar
banal

Community Member, 901 Posts

22 September 2009 at 7:51am

Edited: 22/09/2009 7:51am

According to standards, the rel attribute isn't allowed on elements other than <a> and <link>. That's probably why it gets stripped from your code...

Avatar
borriej

Community Member, 267 Posts

4 August 2010 at 1:52am

Has this been solved yet?

i also want to add some html that gets changed :(

simple javascript on a div:

<div id="item_pic1" OnClick="javascript: window.location = 'url....';" style="cursor: pointer">

Avatar
TotalNet

Community Member, 181 Posts

4 August 2010 at 1:59pm

Try this in your _config.php:

HtmlEditorConfig::get('cms')->setOption('cleanup_callback','');

That will remove the sapphiremce_cleanup function that removes all on* events, it also does more so you might want to take a look and decide if you'll miss any of that. I usually recommend creating a new "HTML Editor Configuration" for power users and leave the default "cms" config in tact.

Go to Top