JDocument/addStyleSheet
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/css' |
$media | string | Media type that the stylesheet applies to. | null |
$attribs | array | Array of attributes. |
Example 1
To add a link to some style sheet at a specific URL, you could use:$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'http://www.example.com/css/mystylesheet.css' );
<link rel="stylesheet" href="http://www.example.com/css/mystylesheet.css" type="text/css" />
Example 2
From a template, you can add a link to a style sheet using a relative URL, like this:$this->addStyleSheet( 'templates/' . $this->template . '/css/mystylesheet.css' );
$this
object will be an object of type JDocumentHTML when called from within a template.
No comments:
Post a Comment