0

我希望一个快速的问题。

我正在使用 Joomla!2.5.8。我刚刚发现了 eCSSential,它在 index.php 中使用了以下代码

    <script>
    <!-- Add eCSSential.min.js inline here -->

    eCSSential({
        "all": "css/all.css",
        "(min-width: 20em)": "css/min-20em.css",
        "(min-width: 37.5em)": "css/min-37.5em.css",
        "(min-width: 50em)": "css/min-50em.css",
        "(min-width: 62.5em)": "css/min-62.5em.css"
    });
 </script>

现在,在我的 Joomla 中!文件我有这个...

<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/eCSSential.js"></script>


<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/nameoftemplate/css/style.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 1024px)" href="<?php echo $this->baseurl ?>/templates/nameoftemplate/css/max-width-1024.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 768px)" href="<?php echo $this->baseurl ?>/templates/nameoftemplate/css/max-width-758.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 524px)" href="<?php echo $this->baseurl ?>/templates/nameoftemplate/css/max-width-524.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/css/lightbox.css"  type="text/css" />

我不太明白我应该如何在脚本的大括号中编写文件路径,以便它在 Joomla! 中工作。我猜使用的示例只是一个普通的目录结构?我尝试了一些组合,但没有任何效果,因为该网站仍然没有样式......

希望有人能帮忙!

4

3 回答 3

0

尝试以下,做了一些小的调整:

<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/eCSSential.js"></script>


<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/style.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 1024px)" href="<?php echo $this->baseurl; ?>/templates/nameoftemplate/css/max-width-1024.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 768px)" href="<?php echo $this->baseurl; ?>/templates/nameoftemplate/css/max-width-758.css" type="text/css" />
<link rel="stylesheet" media="screen and (max-width: 524px)" href="<?php echo $this->baseurl; ?>/templates/nameoftemplate/css/max-width-524.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/lightbox.css" type="text/css" />
于 2012-12-05T14:21:11.733 回答
0

为什么要使用动态模板目录?只要您不切换,只需编写模板名称而不是

<?php echo $this->template?>.

于 2012-12-05T14:13:41.953 回答
0

确保您的模板文件夹名称正确。

那么您可以通过以下方法访问它。

<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/style.css" rel="stylesheet" type="text/css" />

or

<link href="<?php echo JURI::root(); ?>templates/<?php echo $this->template; ?>/css/style.css" rel="stylesheet" type="text/css" />

or

<link href="<?php echo JURI::root(); ?>templates/name of the template_folder/css/style.css" rel="stylesheet" type="text/css" />

在这种情况下,您将更正结果,否则 index.php 渲染会出现一些问题。检查默认模板并确保其工作正常。

于 2012-12-05T15:18:14.930 回答