Zend Framework 位于子文件夹中,但图像取自站点根目录 [英] Zend Framework in a subfolder, but images taken from site root

查看:29
本文介绍了Zend Framework 位于子文件夹中,但图像取自站点根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的测试机器上的一个子文件夹中有一个开发项目设置,它必须留在那里.但是,所有 Zend 框架视图都链接到服务器根目录.

I have a dev project setup in a subfolder on my testing machine and it must stay there. However all the Zend frameworks views are linked to server root.

CSS 链接如下:

<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?

推荐答案

您需要添加
resources.frontController.baseUrl = "/a/b/c/prj1"
到您的配置.
这将设置链接到的 baseurl.

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

请注意 $this->headLink() 助手不知道 baseUrl(可能是 bc 的 bcs).
要使其工作,请使用:
$this->headLink()->appendStylesheet($this->baseUrl('/css/frontend.css'));
$this->headLink()->appendStylesheet($this->baseUrl().'css/frontend.css');
取决于你觉得更舒服

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


根据评论更新

这篇关于Zend Framework 位于子文件夹中,但图像取自站点根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆