Magento路由器网址 - 需要输出路径名称 [英] Magento Router Url - Need Hyphnated Path Name

查看:152
本文介绍了Magento路由器网址 - 需要输出路径名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我使用自定义控制器的URL路径/前端名称为

  / customcategory 

很明显,如果我有一个名为TestController.php和indexAction
的控制器文件,

  / customcategory / test / index 

我想知道的是我如何重命名测试控制器,或者修改配置xml文件,所以我可以有一个连字符的url从控制器文件,如

  / customcategory / test-section / index 

我知道如果我想要 / customcategory 是连字符,我可以修改前端文件。但是我正在构建的网站将受益于一个连字的控制器路由, / customcategory 后的部分与关键字,我不能得到它的工作,也不能找到一个例子



感谢您的时间。

解决方案

据我所知,你不能在网址中添加连字符以匹配文件名。



例如,如果你想要:

 命名空间/ CustomCategory / controller / test / SectionController.php 

您可以:

  / customcategory / test_section / index 
pre>

Let's say I use a custom controller to have a url path/frontend name of

/customcategory

Well, obviously if I have a controller file named 'TestController.php' and indexAction the url path would be

/customcategory/test/index

What I am trying to figure out is how I do re-name the Test Controller, or modify the config xml file, so I can have a hyphenated url from a controller file such as

/customcategory/test-section/index

I know that if I want /customcategory to be hyphenated, I can just modify the frontend tag in the config file. But the site I am building would benefit from a hyphenated controller route, the part that comes after /customcategory with keywords and I cannot get it to work nor can I find an example on google - as crazy as that may seem.

Thanks for your time.

解决方案

As far as I am aware you cannot add hypens in the url to match up to a filename. If you are trying to get a folder structure you can just add more paths to it.

For example if you wanted:

Namespace/CustomCategory/controller/test/SectionController.php

you could do:

/customcategory/test_section/index

这篇关于Magento路由器网址 - 需要输出路径名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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