简体   繁体   English

如何在 typo3 v9.5 中设置路由增强器

[英]How to set up the route enhancer in typo3 v9.5

i have a problem with the routing in 9.5.我在 9.5 中遇到路由问题。 I have two different plugins and two different models.我有两个不同的插件和两个不同的模型。

The storage folders of the models are in the root and different tree pages should access those folders.模型的存储文件夹位于根目录中,不同的树页面应访问这些文件夹。

The routing works fine but if the url slugs are the same, one plugin is not showing the detail view but in that case the list view even if the url is showing the detail view.路由工作正常,但如果 url slugs 相同,则一个插件不会显示详细视图,但在这种情况下,即使 url 显示详细视图,也会显示列表视图。

For example this shows the list view: departments/detail/test1 and this show the correct detail view services/detail/test1例如,这显示了列表视图:departments/detail/test1 这显示了正确的详细视图 services/detail/test1

Below is my current configuration.以下是我当前的配置。 Anyone with an idea whats wrong?任何有想法的人怎么了?

Many thanks in advance提前谢谢了

 ServicelistPlugin:
type: Extbase
extension: Catalog
plugin: Servicelist
routes:
  -
    routePath: '/{service_name}'
    _controller: 'Service::show'
    _arguments:
      service_name: service
defaultController: 'Service::list'
defaults:
  page: '0'
requirements:
  page: \d+
aspects:
  service_name:
    type: PersistedAliasMapper
    tableName: tx_catalog_domain_model_service
    routeFieldName: path_segment


 DepartmentlistPlugin:
    type: Extbase
    extension: Catalog
    plugin: Departmentlist
    routes:
      -
        routePath: '/{department_name}'
        _controller: 'Department::show'
        _arguments:
          department_name: department
    defaultController: 'Department::list'
    defaults:
      page: '0'
    requirements:
      page: \d+
    aspects:
      department_name:
        type: PersistedAliasMapper
        tableName: tx_catalog_domain_model_department
        routeFieldName: path_segment

As described in https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Feature-86365-RoutingEnhancersAndAspects.html#simple-enhancer you have the option to add a limitToPages in your Enhancer.https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5/Feature-86365-RoutingEnhancersAndAspects.html#simple-enhancer中所述,您可以选择添加 limitToPages在你的增强器中。 So your slugs will only take effect in the place you define.所以你的 slug 只会在你定义的地方生效。 This should solve your problem, as I see, your detail plugins are located on different pages.这应该可以解决您的问题,正如我所见,您的详细信息插件位于不同的页面上。

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

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