Jump to:

517 Posts in 247 Topics by 260 members

Content Editor Discussions

SilverStripe Forums » Content Editor Discussions » Tiny MCE Code Strip 2.3.3

Forum for content editors and CMS users.

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

Page: 1
Go to End
Author Topic: 3331 Views
  • 3 midgets In a man suit
    Avatar
    Community Member
    13 Posts

    Tiny MCE Code Strip 2.3.3 Link to this post

    Hello,

    I am having an issue, or should I say have been having an issue with silverstripe not letting me put any kind of code into the individual pages.

    I need to have the ability to do some basic javascript and other things on individual pages such as set parameters etc. on flash files but it strips everything
    <a href="#"
       onmouseover="changeImages('checkbutton_01', 'images/checkbutton_01-over.gif'); return true;"
       onmouseout="changeImages('checkbutton_01', 'images/checkbutton_01.gif'); return true;"
       onmousedown="changeImages('checkbutton_01', 'images/checkbutton_01-over.gif'); return true;"
       onmouseup="changeImages('checkbutton_01', 'images/checkbutton_01-over.gif'); return true;">
       <img name="checkbutton_01" src="images/checkbutton_01.gif" width="219" height="81" border="0" alt=""></a>

    I would also like to be able to do includes at the editing level e.g.
    <% include packages %>

    any help would be greatly appreciated

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Tiny MCE Code Strip 2.3.3 Link to this post

    Generally you should be adding custom javascript via a template or using a separate file that gets included.

    However if you are certain you want to be using TinyMCE to input javascript you'll have to set some options to stop it from stripping elements. The editor in the CMS is controlled via PHP calls in your _config.php file:

    http://doc.silverstripe.com/doku.php?id=htmleditorconfig#setting_tinymce_options_eg_valid_elements

    For Javascript you'll want to add something like this to extended_valid_elements

    script[language|type|src]

    There are many more options you can work with, see the TinyMCE docs:
    http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

    You might want to be very thorough and set invalid_elements to nothing.

    PS. This is a pretty common question, it is covered in many topics you can find via the Search. If you get this to work to your satisfaction please let us know in here and I will be sure to add it to the wiki.

  • Chip Designs
    Avatar
    Community Member
    15 Posts

    Re: Tiny MCE Code Strip 2.3.3 Link to this post

    Hi Dalesaurus,

    I'm, using SS 2.3.7 - Adding script[language|type|src] to the extended_valid_elements found in cms\_config.php seemed to do the trick for me.

    Cheers,
    Rob

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