Actions

API15

JHTML/script

From Joomla! Documentation

< API15:JHTML
Revision as of 17:18, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Write a <script></script> element

[Edit Descripton]

Description:JHTML/script

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;
}

[Edit See Also] SeeAlso:JHTML/script

Examples

<CodeExamplesForm />