2012-07-11 55 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);