I’m using the zend community server on windows vista. I’m following the tutorial in the book Zend Framework 1.8 by Keith Pope.
$this->_view->headLink()->appendStylesheet('/css/main.css');
is not finding the main.css file (404). The actual file path is htdocs/myapp/public/css/main.css . When i take out the slash and change it to
$this->_view->headLink()->appendStylesheet('css/main.css');
it works fine. However when look up an example of the appendStylesheet function in the zend docs, it uses the example
$this->headLink()->appendStylesheet('/styles/basic.css')
So it seems to me what right now “works” for me is incorrect. Any ideas on why this is so?
When you take out the slash, the “< base />” tag will also affect where your stylesheets are loaded from. If the base tag is non-existent, then the css will be loaded relatively to where you are (i.e.: http://localhost/myapp/ will load css from http://localhost/myapp/css/main.css when you’re not using slash in the include)
From your description, I think your document root is pointing to myapp/ instead of myapp/public/ and you’ve got your < base href=”” /> configured to ‘/myapp/’, therefore actually loading the css from ‘/myapp/css/main.css’ when not using the slash.
Also, check the path of your document root.