4

I use TYPO3 V9.5.5 with PHP V7.2.10. Also there is tx-news plugin installed. The site configuration is set and works. But if I add routeEnhancers for news detail it doesnt't show it in the url. It always looks like: http://p510984.mittwaldserver.info/aktuell/detail?tx_news_pi1%5Bnews%5D=5&cHash=c68f25c1ef4b5bd7320220373cfed332

I searched for solutions in stackoverflow and google. Also I read the manual of the news extension https://docs.typo3.org/typo3cms/extensions/news/stable/AdministratorManual/BestPractice/Routing/

Even TYPO3 and PHP cache flushing doesn't help.

At the moment I have following code:

routeEnhancers:
  NewsPlugin:
    type: Extbase
    limitToPages:
      - 17
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

Does it need "defaultController and defaults: page: 0"?

Peter Kraume
  • 3,577
  • 2
  • 21
  • 39
Dan
  • 87
  • 1
  • 7
  • 1
    under aspects, it seems you misspelled "news-title". It should be "news_title" (same as in routes -> arguments). – Nitori Apr 18 '19 at 12:26
  • @Nitori: Thank you for showing me the typo. But unfortunately that doesn't change anything. – Dan Apr 18 '19 at 13:18
  • 3
    I could resolve it! In my Sitepackage which I took from TYPO3 V8.7 I forgot that I had following code: `plugin.tx_news.seetings.link.skipControllerAndAction = 1`. After I uncommented it, it works like a charm. – Dan Apr 23 '19 at 14:38

3 Answers3

0

As Nitori already mentioned in the comment, you need to unify the spelling of news_title / news-title.

But this doesn't seem to be your only problem. Without the aspect, your URL should at least look like:

http://p510984.mittwaldserver.info/aktuell/detail/5&cHash=c68f25c1ef4b5bd7320220373cfed332

This means, the whole route is currently not applied to your detail page.

As you use limitToPages, please check if 17 is the UID of your detail page.


For the pagination widget, category plugins etc. you will need to add the related page UIDs to limitToPages, and of course extend your routes. The news documentation shows examples for these use cases.

sebkln
  • 1,325
  • 1
  • 9
  • 17
  • @sebkin: Thank you for your hint. Yes 17 is id of detail page. Even without the aspect part it shows url like this: http://p510984.mittwaldserver.info/aktuell/detail?tx_news_pi1%5Bnews%5D=5&cHash=c68f25c1ef4b5bd7320220373cfed332 That behaviour is very odd?! So I wonder does it work with TYPO3 V9.5.5? – Dan Apr 18 '19 at 13:28
  • Does it help if you remove `limitToPages` from your configuration (and clear all caches afterwards)? I copied your configuration to my local environment. It works as expected after I applied the described changes. – sebkln Apr 18 '19 at 13:37
  • @sebkin: I removed ```limitToPages``` and it doesen't change anything. Did you test it with TYPO3 V9.5.5? – Dan Apr 18 '19 at 14:05
  • Yes, it is TYPO3 9.5.5. As indentation is important for YAML configuration, it's better to update the config in your question. – sebkln Apr 18 '19 at 14:33
  • How are the links generated? Using the n:link viewhelper? Or something custom (f:link.acton or similar)? If latter, I noticed that leaving out the `controller` and `action` from the url parameters might cause issues. – Nitori Apr 19 '19 at 13:28
0

Thats my config that works fine for me, maybe this helps...

News:
type: Extbase
extension: News
plugin: Pi1
routes:
  - routePath: '/'
    _controller: 'News::list'
  - routePath: '/page-{page}'
    _controller: 'News::list'
    _arguments:
      page: '@widget_0/currentPage'
  - routePath: '/{news-title}'
    _controller: 'News::detail'
    _arguments:
      news-title: news
  - routePath: '/{category-name}'
    _controller: 'News::list'
    _arguments:
      category-name: overwriteDemand/categories
  - routePath: '/{category-name}/page-{page}'
    _controller: 'News::list'
    _arguments:
      category-name: overwriteDemand/categories
      page: '@widget_0/currentPage'
defaultController: 'News::list'
defaults:
  page: '0'
aspects:
  news-title:
    type: PersistedAliasMapper
    tableName: tx_news_domain_model_news
    routeFieldName: path_segment
  page:
    type: StaticRangeMapper
    start: '1'
    end: '100'
  category-name:
    type: PersistedAliasMapper
    tableName: sys_category
    routeFieldName: slug
Tobias Gaertner
  • 1,155
  • 12
  • 30
0

For me this one worked well:

routeEnhancers:
  # news rewrites
  News:
    type: Extbase
    #limitToPages:
    #  - 67
    extension: News
    plugin: Pi1
    routes:
      - { routePath: '/{news-title}', _controller: 'News::detail', _arguments: { news-title: news } }
      #- { routePath: '/cat/{news-cat}', _controller: 'News::list', _arguments: { news-cat: overwriteDemand/categories } }
    defaultController: 'News::list'
    defaults:
      page: '0'
    aspects:
      news-title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment
      news-cat:
        type: PersistedAliasMapper
        tableName: sys_category
        routeFieldName: slug
UnpassableWizard
  • 1,237
  • 11
  • 20