扩展ZfcUsers UserController [英] Extending ZfcUsers UserController

查看:93
本文介绍了扩展ZfcUsers UserController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用setEventManager实现扩展UserController,以显示另一个布局-仅带有登录掩码.

i want to extend the UserController with an setEventManager implementation, to display another layout - just with an login mask.

当我调用网址www.example.com时,我得到了带有其他布局的控制器. 但是,如果输入错误的用户名,我将重定向to www.exmpale.com/user/login,并获得默认的布局.

When i call the url www.example.com i get my Controller, with the other layout. But if type in a wrong username, i redirected to www.exmpale.com/user/login and i get the default layout.

我如何覆盖ZfcUser Module中的所有路由并将它们重定向到我自己的控制器,以确保UserController不能直接调用.

How i can overwrite all routes from ZfcUser Module and redirect them to my own controller, to ensure, the UserController can not called directly.

谢谢.

推荐答案

如果我正确地理解了您的问题,则可能只需要编辑文件module.config.php.它包含所有路由定义.

If I understand your question right, you probably just have to edit the file module.config.php. It contains all route definitions.

根据我对您问题的理解,您有一个名为MyBetterUserController之类的控制器?

From how I understand your question you have an own controller called something like MyBetterUserController?

您可以将自己的模块作为扩展添加到ZfcUser模块,也许您想将其称为ZfcUserMod之类.这个新模块将只包含一个Module.php文件和一个包含配置文件的文件夹config.

You can add an own module as extension to the ZfcUser module, maybe you want to call it something like ZfcUserMod. This new module will only contain a Module.php file and a folder config with the configuration file.

然后,您可以在此模块的配置文件中定义路由,并覆盖ZfcUser中的所有路由.确保使用与ZfcUser完全相同的路由名称(数组中的键)(当前它们使用 zfcuser 作为路由名称).否则,路由将不会被覆盖,并且UrlHelper不会使用您的路由.

Then you can define your routes in this module’s configuration file and overwrite all routes from ZfcUser. Make sure that you use the exactly same route names (the keys in the array) as ZfcUser does (currently they use zfcuser as route name). Otherwise the routes will not be overwriten and the UrlHelper will not use your routes.

然后将ZfcUserMod添加到全局application.config.php 之后 ZfcUser.

Then add ZfcUserMod to the global application.config.php after ZfcUser.

这篇关于扩展ZfcUsers UserController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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