Support Joomla!

references:joomla.framework:document:jdocument-addscript

Table of Contents

addScript

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Document Class JDocument Method addScript Reference addScript() Never Work in Progress

Adds a linked script to the page

Syntax

void addScript ( $url, $type )

$url string is a string containing the URL to the linked script.
$type string is a string containg the type of script. This parameter is optional and if omitted defaults to ‘text/javascript’.

Examples

The following example adds a linked script to the header of the current document.

Example

global $mainframe;
$document = &JFactory::getDocument();
$document->addScript( JURI::base() . 'includes/js/overlib_mini.js' );

Might add the following to the head tag:

Result

<script type="text/javascript" src="http://127.0.0.1/joomla15/includes/js/overlib_mini.js"></script>
 
references/joomla.framework/document/jdocument-addscript.txt (1072 views) · Last modified: 2007/08/15 14:58