包括CSS Zend

时间:2012-12-23 12:32:14

标签: css zend-framework styles head

我正在尝试在我的Zend布局中包含一个名为“style.css”的文件:“index.phtml”。 我的文件夹树是:

    laltroposto
      |-public
      |   |-index.phtml
      |   |-css
      |   |   !-style.css
      |   !-...
      |-application
      |   |-layouts
      |   |   !-scripts
      |   |       !-index.phtml
      |   !...
      !-library
          !-...

这是我的包含css的代码(它是在head的标签中):

<?php echo $this->headLink()->appendStylesheet('css/style.css'); ?>

我也试过了:

<?php echo $this->headLink()->appendStylesheet('/css/style.css'); ?>

这是我的错误:

Failed to load resource: the server responded with a status of 404 (Not Found) http://www.laltroposto.com/js/jquery.js

一些帮助?

3 个答案:

答案 0 :(得分:0)

<?php echo $this->headLink()->appendStylesheet('css/style.css'); ?>

/css/style.css = index.phtml/css/style.css

你在css之前有一个额外的斜杠!

答案 1 :(得分:0)

我决定在www.laltroposto.org而不是www.laltroposto.com上托管我的网站......我不知道为什么!

答案 2 :(得分:0)

您的css文件确实没有问题,但是使用js one:jquery.js

404 (Not Found) http://www.laltroposto.com/js/jquery.js

如前所述,不要忘记在js加载文件的开头路径添加斜杠,否则它被视为路径,并且它会发送到404错误页面。

希望能帮到你。