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

Add JavaScript to Administrative Area


Reply

4 Posts   1944 Views

Avatar
Deklin

12 July 2010 at 10:54pm Community Member, 16 Posts

This code adds my custom JavaScript to BOTH the administrative area AND the public website:

// from mysite/code/page.php
function getCMSFields() {
Requirements::javascript( 'mysite/javascript/custumL.js ' );
}

I only want to add the JavaScript to the administrative area. It should NOT be loaded on the public website.

Avatar
Willr

13 July 2010 at 4:36pm Forum Moderator, 5511 Posts

Use this in your _config file

LeftAndMain::require_javascript('mysite/javascript/custumL.js');

LeftAndMain is the class which handles the CMS. Though unless you call getCMSFields() on the front end of the site it shouldn't include any JS from that function.

Avatar
Deklin

14 July 2010 at 9:24am Community Member, 16 Posts

Thanks!

Avatar
Lukin

28 February 2012 at 3:26am Community Member, 42 Posts

Is this still working in 2.46?
I tried it without success....