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.

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

报告相同问题?

悬赏问题

  • ¥21 matlab怎么求时域信号的二阶导数
  • ¥15 判断两个表是否完全相同
  • ¥15 java map类型数据格式,如何快速通过前缀匹配元素
  • ¥15 stc12c5a60s2、QMC5883L、LCD1602组合测量磁场所需程序
  • ¥20 Win11测试yolov4,“找不到nvcuda.dll”怎么办?
  • ¥15 simulink绘制bode图
  • ¥15 php_network_getaddresses: getaddrinfo failed: Name or service not known
  • ¥15 用msg发消息出现的问题
  • ¥15 unity3d机械臂
  • ¥20 工控机出现散热器转一下停一下这种情况,是什么原因造成的