如何将字符串添加到joomla标头?
问题描述:
我知道使用JFactory::getDocument();
我可以在标头中添加一些JS代码,但此刻我需要添加这种类型的行<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
是否有一些默认方法?
I know that with JFactory::getDocument();
i can add some JS code to the header, but at the moment i need to add this kind of line <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
Is there some default methods?
答
您可以使用Jdocument来做到这一点:
You can do this using Jdocument:
$document=JFactory::getDocument();
$customtag='<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]--> ';
$document->addCustomTag( $customtag);