2011-08-05 7 views

답변

7

은 텍스트와 함께 작동하지만 당신이 시도 할 수 있다면 확실하지 :

$document =& JFactory::getDocument(); 
$document->addCustomTag('<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/excanvas.min.js"></script><![endif]-->'); 

을 나는 그것이 도움이 될 것입니다 바랍니다.

+0

실제로 솔루션은 http://docs.joomla.org/JDocumentHTML/addCustomTag에서 작동합니다. addCustomTag를 사용할 수 있는지 알지 못했습니다. 엄지 척 :) –

1

당신은 사용할 수 있습니다 : 나는 비록 조건문을 추가하는 방법을 찾고 있어요

<?php 
    $document = &JFactory::getDocument(); 
    $document->addScript('/js/excanvas.min.js'); 
?> 

...

UPDATE

확인 사용자 에이전트가 IE의 경우

<?php 
    $document = &JFactory::getDocument(); 

    //Is it Internet Explorer? 
    ereg('MSIE ([0-9]\.[0-9])',$_SERVER['HTTP_USER_AGENT'],$reg); 

    if(isset($reg[1])) { 
     //Yes, it is Internet Explorer 
     $document->addScript('/js/excanvas.min.js'); 
    } 
?>