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   2007 Views

Avatar
Deklin

Community Member, 16 Posts

12 July 2010 at 10:54pm

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

Forum Moderator, 5513 Posts

13 July 2010 at 4:36pm

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

Community Member, 16 Posts

14 July 2010 at 9:24am

Thanks!

Avatar
Lukin

Community Member, 42 Posts

28 February 2012 at 3:26am

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