更改 Zend Framework 模块视图脚本路径
当前查看位于 APPLICATION_PATH 中的脚本。 '/modules/my_module/views/scripts/'。我想将脚本放在 '/modules/my_module/views/'
中(删除脚本文件夹)。如何实现这一目标?
应用程序.ini:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
resources.view.scriptPath.default = APPLICATION_PATH "/views"
Currently view scripts located in APPLICATION_PATH . '/modules/my_module/views/scripts/'
. I want to place scripts in '/modules/my_module/views/'
(remove scripts folder). How to achieve this?
application.ini:
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
resources.view.scriptPath.default = APPLICATION_PATH "/views"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
setScriptPath(APPLICATION_PATH . '/modules/my_module/views ')
查看方法来替换脚本路径。您还可以使用
addScriptPath 添加脚本路径,而不覆盖前一个路径(APPLICATION_PATH。'/modules/my_module/views')
。我用它来组织不同文件夹中的视图脚本。希望有帮助...
You could use the
setScriptPath(APPLICATION_PATH . '/modules/my_module/views')
view method to replace the script path.You can also add your script path without overriding the previous one, using
addScriptPath(APPLICATION_PATH . '/modules/my_module/views')
. I use it to have organized the view scripts in different folders.Hope that helps...
如果您想更改任何操作的视图脚本
在您的控制器操作中添加以下内容:
$this->view->addScriptPath(APPLICATION_PATH . 'your/path');
$this->renderScript('list.phtml');
if you want change view script for any action
inside your controller action add this:
$this->view->addScriptPath(APPLICATION_PATH . 'your/path');
$this->renderScript('list.phtml');
我知道这已经很老了,但它可能会对某人有所帮助。我也有同样的问题。我通过使用实现了这一点
I know this is pretty old but it may help someone. I had this same problem. I achieved this by using