dongronge3732 2018-06-01 17:34
浏览 41
已采纳

TYPO3:使用tx_news重复斜杠 - 已解决但未被理解

I'm simply using the official realurl conf on the tx_news documentation. That caused a duplicate slash in my url. It would look like that:

domain.com/post//post-title

To fix it, I found out that I either have to remove or place the following lines after the tx_newspil[news] inside the fixedPostVars:

Before:

'fixedPostVars' => [
    'newsDetailConfiguration' => [
        [
            'GETvar' => 'tx_news_pi1[action]',
            'valueMap' => [
                '' => 'detail',
            ],
            'noMatch' => 'bypass'
        ],
        [
            'GETvar' => 'tx_news_pi1[controller]',
            'valueMap' => [
                '' => 'detail',
            ],
            'noMatch' => 'bypass'
        ],
        [
            'GETvar' => 'tx_news_pi1[news]',
            'lookUpTable' => [
                'table' => 'tx_news_domain_model_news',
                'id_field' => 'uid',
                'alias_field' => 'IF(path_segment!="",path_segment,title)',
                'addWhereClause' => ' AND NOT deleted',
                'useUniqueCache' => 1,
                'languageGetVar' => 'L',
                'languageExceptionUids' => '',
                'languageField' => 'sys_language_uid',
                'transOrigPointerField' => 'l10n_parent',
                'expireDays' => 180,
                'enable404forInvalidAlias' => true
            ]
        ]
    ]
]

After:

'fixedPostVars' => [
    'newsDetailConfiguration' => [
        [
            'GETvar' => 'tx_news_pi1[news]',
            'lookUpTable' => [
                'table' => 'tx_news_domain_model_news',
                'id_field' => 'uid',
                'alias_field' => 'IF(path_segment!="",path_segment,title)',
                'addWhereClause' => ' AND NOT deleted',
                'useUniqueCache' => 1,
                'languageGetVar' => 'L',
                'languageExceptionUids' => '',
                'languageField' => 'sys_language_uid',
                'transOrigPointerField' => 'l10n_parent',
                'expireDays' => 180,
                'enable404forInvalidAlias' => true
            ]
        ],
        [
            'GETvar' => 'tx_news_pi1[action]',
            'valueMap' => [
                '' => 'detail',
            ],
            'noMatch' => 'bypass'
        ],
        [
            'GETvar' => 'tx_news_pi1[controller]',
            'valueMap' => [
                '' => 'detail',
            ],
            'noMatch' => 'bypass'
        ]
    ]
]

Either switching them or simply deleting the controller / action parts fixed the duplicate slash. Now I'd like to understand why that is so, since im a PHP beginner I don't really get it.

I appreciate all the help!

** Just tested, only the action part had to be moved or deleted in order to resolve the duplicate slash

  • 写回答

1条回答 默认 最新

  • doupi3874 2018-06-01 18:03
    关注

    This happens because the REALURL configuration gets parameters in the order you add.

    Let's take the first REALURL configuration from your post. Within this configuration I expect my URL be so: /page/action/controller/post-title.

    What happens there is that you have the news plugin with action and controller params set in the post page and then you don't pass the action and controller in the URL, that's why you have double slashes there, because action and controller are empty.

    Default parameters (e.q controller name, action name, etc), parameters where the value is not required, must be at the end of the configuration, like your last configuration.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型