Saturday, May 25, 2013

How to add a custom tag at the head tag of joomla! 1.5, 2.5 and 3.x

Here code exemple of inclusion of a stylesheet link within conditional comments, so that it is picked up only by Internet Explorer 6 and earlier.

// link with conditional comments tag in variable
$stylelink = '<!--[if lte IE 6]>' ."\n";$stylelink .= '<link rel="stylesheet" href="../css/IEonly.css" />' ."\n";
$stylelink .= '<![endif]-->' ."\n"; 
// send tag code to the head tag of page
$document = JFactory::getDocument();
$document->addCustomTag($stylelink);

You can add you custom tags, like <meta>  or others...
Disqus Comments