Support Joomla!

references:joomla.framework:document:jdocument-addstylesheet

Table of Contents

addStyleSheet

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

Adds a linked stylesheet to the page.

Syntax

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.

Examples

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" />
 
references/joomla.framework/document/jdocument-addstylesheet.txt (1133 views) · Last modified: 2007/08/15 14:58