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.

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

报告相同问题?

悬赏问题

  • ¥15 VB6可以成功读取的文件,用C#读不了
  • ¥15 如何使用micpyhon解析Modbus RTU返回指定站号的湿度值,并确保正确?
  • ¥15 C++ 句柄后台鼠标拖动如何实现
  • ¥15 有人会SIRIUS 5.8.0这个软件吗
  • ¥30 comsol仿真等离激元
  • ¥15 静电纺丝煅烧后如何得到柔性纤维
  • ¥15 (标签-react native|关键词-镜像源)
  • ¥100 照片生成3D人脸视频
  • ¥15 伪装视频时长问题修改MP4的时长问题,
  • ¥15 JETSON NANO