自定义模块中的管理路由 [英] Admin route in custom modules

查看:109
本文介绍了自定义模块中的管理路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有股票magento模块的后端都有URL路径,该路径具有"admin"(默认)部分. 但是,对于自定义模块,我无法实现这一目标.这是不可能的还是有目的的?

All stock magento modules have URL path in backend which has 'admin' (by default) part. However I was not able to achieve that for a custom module. Is this not possible or done on a purpose?

谢谢

推荐答案

URL的第一部分称为"frontName".

The first part of the URL is known as the "frontName".

http://example.magento.com/frontName/controllerName/actionName

Magento仅允许单个模块声明特定的frontName.对于admin的姓,就是Adminhtml.

Magento only allows a single module to claim a particular frontName. For the admin frontname, that's Adminhtml.

但是,Magento 1.3引入了一种配置语法,该语法允许您告诉已经声明其名字的特定模块(该模块)应检查其他模块的名称.控制器文件.此功能通常称为实际控制器替代,并且您可以使用它替换自己的Magento中的特定控制器,也可以使用(并且应该使用它)来设置自己的控制器管理控制台的控制器.唯一需要注意的是,如果Magento使用的是您在将来版本中选择的控制器名称,则升级时需要进行调整. (换句话说,选择唯一的名称)

However, Magento 1.3 introduced a configuration syntax that allows you to a tell particular module that's already claimed a front name that it (the module) should check additional modules for controller files. This feature is often called real controller overrides, and while you can use it to replace a particular controller in Magento with your own, you can also use (and should use it) it to setup your own controllers for the admin console. The only caveat here is if Magento uses a controller name that you've already picked in a future version, you'll need to adjust things when you upgrade. (in other words, pick unique names)

如果您对这些细节感兴趣,我正在撰写有关Magento的路由的系列文章引擎,它将为您提供比您所需要知道的更多的细节.

If you're interested in the details, I'm in the middle of writing a series on Magento's routing engine, which will give you more detail than you'll ever need to know.

这篇关于自定义模块中的管理路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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