Actions

Difference between revisions of "JDocument/addStyleSheet"

From Joomla! Documentation

(New page: Adds the definition of a linked external stylesheet to the document. Duplicates are ignored. ===Syntax=== void addStyleSheet( $url, $type, $media, $attribs ) where: {| class="wikitable" ...)
 
m (Missed & in code sample.)
Line 33: Line 33:
 
To add a link to some JavaScript code at a specific URL, you could use:
 
To add a link to some JavaScript code at a specific URL, you could use:
 
<source lang="php">
 
<source lang="php">
$doc = JFactory::getDocument();
+
$doc =& JFactory::getDocument();
 
$doc->addScript( “http://www.example.com/js/myscript.js” );
 
$doc->addScript( “http://www.example.com/js/myscript.js” );
 
</source>
 
</source>

Revision as of 05:00, 8 September 2008

Adds the definition of a linked external stylesheet to the document. Duplicates are ignored.

Syntax

void addStyleSheet( $url, $type, $media, $attribs )

where:

Argument Data type Description Default
$url string URL of stylesheet.
$type string MIME type of script. 'text/javascript'
$media string Media type that the stylesheet applies to. null
$attribs array Array of attributes.

Example

To add a link to some JavaScript code at a specific URL, you could use:

$doc =& JFactory::getDocument();
$doc->addScript( “http://www.example.com/js/myscript.js” );

See also