Adding a link to a CSS file to the document
From Joomla! Documentation
Revision as of 19:44, 14 November 2009 by Chris Davenport
To add a link to a CSS file to the document, you could use:
$doc =& JFactory::getDocument(); $href = 'index.php/other/css/mycss.css'; $attribs = array('type' => 'text/css'); $doc->addHeadLink( $href, 'stylesheet', 'rel', $attribs );
When the document is rendered this will produce the following in the HTML <head> section:
<link href="/index.php/other/css/mycss.css" rel="stylesheet" type="text/css" />
This is an alternative to using JDocument->addStyleSheet.