当我在页面之间移动时,有些页面根本没有CSS。事实证明,页面的别名(例如“ sem03”)已添加到css链接标记的开头。
在FireBug中删除链接的前缀后,它可以正常工作。
我的问题是:如何从CMS本身页面的任何组件的链接标签中删除此前缀?管理系统中可以解决此问题的措施是什么?
例如 :
真正的标签应为:
<link type="text/css" href="/templates/protostar/css/template.css" rel="stylesheet">
不是这样的:
<link type="text/css" href="/08-sem03/templates/protostar/css/template.css" rel="stylesheet">
最佳答案
您在模板index.php(www / yourjoomlafolder / templates / index.php)中的标签应看起来像这样,以避免出现这种情况...
$doc = JFactory::getDocument();
$doc->addStyleSheet('templates/'.$this->template.'/css/template.css');
要么
<link type="text/css" href="<?= $this->baseurl ?>/templates/<?= $this->template ?>/css/template.css" rel="stylesheet">
了解
<?= $variable ?>
等同于<?php echo $variable; ?>
或<?php print($variable) ?>
。只是想为任何不使用或不了解PHP速记的人清除这些错误。
关于css - joomla 3-别名使无法连接CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17236778/