2012-07-11 60 views

回答

1

在你的組件使用:

$js = JUri::root() . 'mycssFolder/style.css'; 
    $doc = JFactory::getDocument(); 
    $doc->addScript($js); 

更多信息http://docs.joomla.org/JDocument/addScript

+0

這幫了我很多。儘管應該是'$ doc-> addStyleSheet($ js);'用於添加樣式表 – suo 2017-01-06 13:26:17

3

現在正發生這種情況。 在文件\com_yourcomponent\views\yourview\view.html.php,功能display()內,

$document->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css'); 
$document->addCustomTag('<script type="text/javascript" src="components/com_yourcomponent/js/jquery-1.7.2.min.js"></script>'); 
1

在的Joomla! 2.5,我在視圖display()中使用了下面的代碼:

JHtml::stylesheet(JURI::base() . 'components/com_mycomponent/css/mycomponent.css', array(), true);