Saturday, May 25, 2013

How to add CSS Code at the head tag of page in Joomla! 1.5, 2.5, 3.x

Here code exemple of how to add css code using Joomla! framework to add it in head tog of your page:
$document = JFactory::getDocument();

// If you want add style sheet file in the head tag
$document->addStyleSheet(JURI::base() . 'modules/mod_example/css/mod_example.css');

// add CSS Code in variable
$style = '#example {
border-color:#' . $bordercolor . ';

// send variable content in head tag
$document->addStyleDeclaration( $style );

Disqus Comments