Presumably, you're reading this because you want to streamline your J1.6 app.
Given this, what I was able to conclude is that if you want to cleanly remove those hefty Mootools libs, you have to pass something to the function.
That is, passing a NULL array as the params for 'scripts' to setHeadData won't work. You'll get a forward slash for an src param in a superfluous script tag. Alternatively, some discussions will try to tell you passing empty strings will work ... but they don't have error/notifications turned on.
So, you could pass an src to a 0kb (empty) js file. Or, for me, I passed jQuery:
In the top of your template's index.php:
// replace default scripts with jQuery
// load jQuery instead
$headers = array(
'scripts' => array(
$this->baseurl . "/templates/" . // directory of templates
$this->template . // 'this' template
"/js/" . // folder for javascript files
"jquery-1.6.1.min.js" // filename
=> array(
'mime' => 'text/javascript', // 'type'
'defer' => NULL,
'async' => NULL)
)
);
$this->setHeadData($headers);
HEAD before the change:
<script src="/media/system/js/core.js" type="text/javascript"></script>
<script src="/media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="/media/system/js/caption.js" type="text/javascript"></script>
<script src="/media/system/js/mootools-more.js" type="text/javascript"></script>
HEAD after the change:
<script src="/templates/templatename/js/jquery-1.6.1.min.js" type="text/javascript"></script>
Bob's Yer Uncle.
No comments:
Post a Comment