Objective

To load a CSS file into a Joomla PHP page.

Example

Defining URL of the CSS file in $url variable...

$url = "components/com_mycomponent/assets/css/style.css";

Loading $url CSS file...

$document = JFactory::getDocument();
$document->addStyleSheet($url);

N.B.: It used to be possible with JHTML. However, this was deprecated in Joomla 2.5 and removed in Joomla 3.x.


See also

Source

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.