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.

Customising the CMS /

How to force TinyCME to accepts JS command?


Reply


4 Posts   1298 Views

Avatar
wilsonStaff

Community Member, 142 Posts

11 May 2010 at 1:59pm

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!

Avatar
Willr

Forum Moderator, 5513 Posts

11 May 2010 at 10:48pm

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

Avatar
wilsonStaff

Community Member, 142 Posts

12 May 2010 at 12:21am

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!

Avatar
wilsonStaff

Community Member, 142 Posts

12 May 2010 at 1:31pm

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

Thanks to all.