Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How to force TinyCME to accepts JS command?

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

Page: 1
Go to End
Author Topic: 1268 Views
  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    How to force TinyCME to accepts JS command? Link to this post

    Hi to all, i am trying to add HTML capacities (via extend command) as a user wrote a while ago, see below:

    (...)
    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.
    (...)

    But i cant find the cms/javascript/tinymce.template.js file into the 2.4 version? Does it still exist?

    How can i force TinyCME to accept scripts like this one?

    <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4bdf7462739489da"></script>

    OR SIMPLIER

    How to access HTML headers to add the previous line into my home page headers?

    Thanks!

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: How to force TinyCME to accepts JS command? Link to this post

    But i cant find the cms/javascript/tinymce.template.js file into the 2.4 version? Does it still exist?

    No you don't edit that file any more. You need to use the HtmlEditorConfig class. For example put this in your mysite/_config.php file.

    HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', "script[type|src],img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]");

    Note how script has been added at the start (with the allowed elements type and src). You should now reload the cms and be able to insert scripts with those attributes

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: How to force TinyCME to accepts JS command? Link to this post

    OK, heres what i did:

    - with Dreamweaver via its FTP panel, i downloaded mysite/_config.php file
    - i copied the line you suggested just before the closing tags which is ?>
    - i uploaded the mysite/_config.php back onto the server
    - i relogged myself as admin ***
    - copied my script

    Still skipping the script line.

    *** Is that what you call reload the CMS???? If not, how to?

    Many thanks!

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: How to force TinyCME to accepts JS command? Link to this post

    OK, leave that alone. I succeeded adding the JS into the headers.

    Thanks to all.

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