繁体   English   中英

使用RealURL处理可能为空的参数

[英]Handling of parameters which can be empty with RealURL

我有一条生成的路径,其中包含不同的类别和使用自己的扩展程序制造的产品。 可以有一个,两个或三个类别,再加上第二个或第三个类别下方的产品。

可以使用的网址示例:

/mainCategory/
/mainCategory/secondCategory/
/mainCategory/secondCategory/product-title
/mainCategory/secondCategory/thirdCategory/
/mainCategory/secondCategory/thirdCategory/product-title

现在的问题是显示产品不是必需的thirdCategory。
我的配置:

'fixedPostVars' =>
    [
        'produkt' =>
            [
                0 =>
                     [
                          'GETvar' => 'tx_vendor_plugin[mainCategory]',
                           'lookUpTable' =>
                               [
                                   'table' => 'sys_category',
                                   'id_field' => 'uid',
                                   'alias_field' => 'title',
                                   'languageGetVar' => 'L',
                                   'languageField' => 'sys_language_uid',
                                   'transOrigPointerField' => 'l10n_parent',
                                   'useUniqueCache' => 1,
                                   'useUniqueCache_conf' =>
                                       [
                                           'strtolower' => 1,
                                           'spaceCharacter' => '-',
                                       ],
                                    ],
                            ],
                        1 =>
                            [
                                'GETvar' => 'tx_vendor_plugin[subCategory]',
                                'lookUpTable' =>
                                    [
                                        'table' => 'sys_category',
                                        'id_field' => 'uid',
                                        'alias_field' => 'title',
                                        'languageGetVar' => 'L',
                                        'languageField' => 'sys_language_uid',
                                        'transOrigPointerField' => 'l10n_parent',
                                        'useUniqueCache' => 1,
                                        'useUniqueCache_conf' =>
                                            [
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-',
                                            ],
                                    ],
                            ],
                        2 =>
                            [
                                'GETvar' => 'tx_vendor_plugin[thirdCategory]',
                                'lookUpTable' =>
                                    [
                                        'table' => 'sys_category',
                                        'id_field' => 'uid',
                                        'alias_field' => 'title',
                                        'languageGetVar' => 'L',
                                        'languageField' => 'sys_language_uid',
                                        'transOrigPointerField' => 'l10n_parent',
                                        'useUniqueCache' => 1,
                                        'useUniqueCache_conf' =>
                                            [
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-',
                                            ],
                                    ],
                            ],
                        3 =>
                            [
                                'GETvar' => 'tx_vndor_plugin[product]',
                                'lookUpTable' =>
                                    [
                                        'table' => 'tx_vendor_domain_model_product',
                                        'id_field' => 'uid',
                                        'alias_field' => 'title',
                                        'languageGetVar' => 'L',
                                        'languageField' => 'sys_language_uid',
                                        'transOrigPointerField' => 'l10n_parent',
                                        'useUniqueCache' => 1,
                                        'useUniqueCache_conf' =>
                                            [
                                                'strtolower' => 1,
                                                'spaceCharacter' => '-',
                                            ],
                                    ],
                            ],
                    ],

当我向noMatch => bypass添加noMatch => bypass ,它不会显示任何第三类别。 每三个类别都无法访问。

当我不带noMatch => bypass使用它时,URL中有一个空路径参数,用于不包含第三类的产品: /mainCategory/secondCategory//product-title

谁可以帮助我呢?

这是德米特里(Dmitry)在TYPO3 Slack中提出并回答的

换句话说:在postVar的开头或中间不能有可选参数。

因此,可以断定RealURL不可能做到这一点。

一个例子:

/mainCategory/secondCategory/product-title/
/mainCategory/secondCategory/thirdCategory/

RealURL应该如何知道在此处解码product-titlethirdCategory 这是模棱两可的,因为它可能是产品或类别。 这就是为什么RealURL对任何在开头/中间可以选择的内容都使用空路径段的原因。

暂无
暂无

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

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