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

Associating a javascript file to each page, and not in Page.php or template


Reply


2 Posts   3639 Views

Avatar
kudesign

Community Member, 64 Posts

7 December 2008 at 11:01am

Edited: 07/12/2008 11:02am

I know how to include a JavaScript file in Page.php, and in the template, but what this loads the javascript regardless if you use it or not.

I was wondering if there is a way to associate a javascript file to each of the pages, so that it is loaded when called, or needed.

The admin content editing area cleans out <script> put in the html code, is there a way to leave the <script> code in?

thanks!

Avatar
kudesign

Community Member, 64 Posts

7 December 2008 at 10:02pm

I have found a solution to this problem.

The solution is to modify cms/javascript/tinymce.template.js and a line in:

valid_elements : (near line 43)

to allow <script> in your TinyMCE HTML

For more detail please check out this link:
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

This way, I can include the <script> to the HTML, to only the page I want.