| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Document |
JDocument |
addStyleSheet |
addStyleSheet() |
Never | Work in Progress |
Adds a linked stylesheet to the page.
void addStyleSheet ( $url, $type, $media, $attribs )
| $url | string | is a string containing the URL to the linked style sheet. |
| $type | string | is a string containing the mime encoding type of the stylesheet. This parameter is optional and if omitted defaults to ‘text/css’. |
| $media | string | is a string containing the media type which the stylesheet applies to. This parameter is optional and if omitted defaults to null. |
| $attribs | mixed | is a an array containing the attributes for the stylesheet. |
This example adds a link to a stylesheet in the head block of the current page.
Example
global $mainframe; $document = &JFactory::getDocument(); $document->addStyleSheet( JURI::base() . 'templates/rhuk_milkyway/css/template.css', 'text/css', null, array( 'id' => 'StyleSheet' ) );
Might add the following code to the head block of the current page:
Result
<link rel="stylesheet" href="http://127.0.0.1/joomla15/templates/rhuk_milkyway/css/template.css" type="text/css"id="StyleSheet" />