在同一视图中使用多个模块 [英] Using several modules in the same view

查看:39
本文介绍了在同一视图中使用多个模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Zend Framework 1.12 开发 Web 应用程序,这对我来说是新事物,我不确定如何做我想做的事情.

I'm developing a web application with Zend Framework 1.12, which is something new to me, and I'm not sure about the way to do something I want to.

当我谈论模块时,我的意思是控制器,抱歉,我仍然误解了这些术语......

When I talk about Module, I mean Controller, sorry for that, I still mistake the terms ...

在我的主页上,模块索引,我用它做了我想做的事,创建了几个动作和所有的东西,但我想添加一个我自己做的搜索引擎.

On my home page, the module Index, I made what I wanted to do with it, created several actions and all the stuff, but I'd like to add a search engine I'll make myself.

问题是,例如,我想将搜索引擎创建为名为 Search 的单独模块,但将 SearchForm 放在主页中.点击提交会将表单中的数据发送到搜索模块.

The problem is that I'd like to create the search engine as a separate module named Search, for example, but put the SearchForm in the home page. Hitting submit would send the datas from the form to the Search module.

我不太明白如何做到这一点,而不必转到/search 来访问我的表单和所有相关操作.

I don't quite understand how to do that without having to go to /search to access my form and every associated actions.

我必须使用视图助手吗?

Do I have to use a View Helper ?

此外,首页中的 searchForm 将是某种 QuickKSearch,访问/search 将显示更详细的研究表单.

Also, the searchForm in the front page would be some sort of QuicKSearch and accessing /search would show a more elaborated form for the research.

有人可以向我解释如何从 Index 模块访问 searchForm 或将我重定向到讨论该内容的文档部分吗?我的研究没有成功,Google 也没有帮助我.

Can someone explain me how to access the searchForm from the Index module or redirect me to the part of the documentation talking about that ? My research are unsuccessful and Google doesn't help me either.

当我谈论模块时,我的意思是控制器,抱歉,我仍然误解了这些术语......

When I talk about Module, I mean Controller, sorry for that, I still mistake the terms ...

推荐答案

首先,将 searchform 构建为 viewHelper,然后您可以在多个视图中重用它.表单片段中的 action 属性设置为 searchModule/controller/action.

First of all, build the searchform as viewHelper, then you can reuse it in several views. The action attribute in form snippet set to searchModule/controller/action.

另外研究 Zend 文档中的 viewHelper 和 Forms.

Additionaly make research about viewHelpers and Forms in Zend Documentation.

这篇关于在同一视图中使用多个模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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