Page 1 of 1
Add Link to Javascript Files In Admin Head Area Of Template
Posted: Mon Feb 14, 2011 3:36 am
by jeverd01
I've searched the form and can't seem to find a simple solution. I want to add a link to a static JavaScript file that my module will use to the header of the admin section, basically so I can call datepicker since I see jquery-ui is already included in the admin theme.
Is there any easy way to load specific JS files on certain admin tabs?
Re: Add Link to Javascript Files In Admin Head Area Of Templ
Posted: Sun Apr 03, 2011 10:44 pm
by jeverd01
I guess putting jquery in the body of the document and using document.ready works. It's not the best practice but it works.
Re: Add Link to Javascript Files In Admin Head Area Of Templ
Posted: Tue Apr 05, 2011 10:42 pm
by kidcardboard
Put this in your <modulename>.module.php file
Code: Select all
function GetHeaderHTML() {
global $gCms;
$config = $gCms->GetConfig();
return "\r<script type='text/javascript' src='".$config['root_url']."/modules/<modulename>/lib/script.js'></__script>";
}