JHTML/script: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Write a <script></script> element
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki... |
m removing red link to edit, no existant pages |
||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 55: | Line 55: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
| Line 70: | Line 70: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Revision as of 17:22, 12 May 2013
Description
Write a <script></script> element
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
script($filename, $path= 'media/system/js/', $mootools=true)
| Parameter Name | Default Value | Description |
|---|---|---|
| $filename | The name of the script file * | |
| $path | 'media/system/js/' | The relative or absolute path of the script file |
| $mootools | true | If true, the mootools library will be loaded |
Defined in
libraries/joomla/html/html.php
Importing
jimport( 'joomla.html.html' );
Source Body
function script($filename, $path = 'media/system/js/', $mootools = true)
{
// Include mootools framework
if($mootools) {
JHTML::_('behavior.mootools');
}
if(strpos($path, 'http') !== 0) {
$path = JURI::root(true).'/'.$path;
};
$document = &JFactory::getDocument();
$document->addScript( $path.$filename );
return;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />