开发者

Zend Framework in a subfolder, but images taken from site root

I have a dev project setup i开发者_如何学Gon a subfolder on my testing machine and it must stay there. However all the Zend frameworks views are linked to server root.

CSS are linked like:

<link type="text/css" href="<?php echo $this->baseUrl('/css/frontend.css') ?>" rel="Stylesheet" />  

Which must be stayed this way, but it should link to

localhost/a/b/c/prj1/css/frontend.css

How can I setup a global subdirectory for this?


You need to add
resources.frontController.baseUrl = "/a/b/c/prj1"
to your configuration.
This will set the baseurl wher to link to.

Be aware the $this->headLink() helper isn't aware of the baseUrl (probably bcs of bc).
To make it work use either:
$this->headLink()->appendStylesheet($this->baseUrl('/css/frontend.css')); or
$this->headLink()->appendStylesheet($this->baseUrl().'css/frontend.css');
depending on what you feel more comfortable with

Edit:
updated according to comments


i am not sure if i understand it clearly but try to :

if you are on linux : don't edit the code and symlink to folder /images/ to /a/b/c/prj1/images/

update

form your comments with samual :

you can use something like :

    <?php
    $view->headLink()->appendStylesheet($this->baseUrl("css/reset.css"))
            ->appendStylesheet($this->baseUrl("css/text.css"))
            ->appendStylesheet($this->baseUrl("css/960.css"))
            ->appendStylesheet($this->baseUrl("css/demo.css"));
    echo $this->headLink();
    ?>


Why do you want it in a subdirectory of your project?

Your landing page when going to the url should point to the public folder. This is were all css/js/images should be placed. Your other project files should be set with the right permissions for security.

Of course it's possible to set the css folder with different security settings because it's in your project folder but I don't see the point of doing it that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜