简体   繁体   English

如何在 Shopware 5 controller 路线中使用破折号以及如何以小写字母开头?

[英]How to use dashes in Shopware 5 controller route and how to start in with small letters?

As I know in php the class name should not include lines and shopware takes the class name as the route to the controller's action.正如我在 php 中所知道的,class 名称不应包含线条,并且商店软件将 class 名称作为控制器操作的路径。 Is it possible to have dashes in the route somehow and also have all letters be small?是否有可能以某种方式在路线中使用破折号并且所有字母都变小?

Example of what needs to be achieved:需要实现的示例:

class example-name-for-route{
}

expected route:预期路线:

www.example.com/example-name-for-route

The easiest way would be creating a SEO URL for your custom controller, so the naming of the controller class is not relevant. The easiest way would be creating a SEO URL for your custom controller, so the naming of the controller class is not relevant. How this is done is explained here . 这里解释了这是如何完成的。

Just subscribe to the event Shopware_CronJob_RefreshSeoIndex_CreateRewriteTable and call the method sInsertUrl of the sRewriteTable core class.只需订阅事件Shopware_CronJob_RefreshSeoIndex_CreateRewriteTable并调用sRewriteTable核心 class 的sInsertUrl sInsertUrl。 The first parameter is 'sViewport=yourControllerName' and the second the actual URL you want the controller to be available at.第一个参数是'sViewport=yourControllerName' ,第二个参数是您希望 controller 可用的实际 URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM