将 RealURL 与 JOIN 语句一起使用 (TYPO3)

发布于 2024-12-28 17:57:57 字数 634 浏览 4 评论 0原文

我在一个网站上使用 RealURL,我想在“lookUpTable”语句中连接两个表。生成的 URL 应该是表 a 和表 b 中的字段的组合。

所以基本上我想在 tableaddWhereClause 中进行 JOIN,而不是使用多个 alias_fields

标准语法是:

'lookUpTable' => array(
                            'table' => 'user_3dsplmxml_bfsbrand',
                            'id_field' => 'xml_id',
                            'alias_field' => 'xml_title',
                            'maxLength' => 10,
                            'addWhereClause' => ' AND NOT deleted'
                        )

手册没有给出这是否可能的提示,但它会有很大的用处。有人知道这是否可以做到吗?

I'm using RealURL on a site where I would like to join two tables in the "lookUpTable" statement. The resulting URL should be a combination of fields in table a and table b.

So basically I would like to do a JOIN in table and addWhereClause and than use multiple alias_fields.

The standard syntax is:

'lookUpTable' => array(
                            'table' => 'user_3dsplmxml_bfsbrand',
                            'id_field' => 'xml_id',
                            'alias_field' => 'xml_title',
                            'maxLength' => 10,
                            'addWhereClause' => ' AND NOT deleted'
                        )

The manual gives no hint if this is possible, but it would be of great use. Anyone knows if this can be done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你怎么这么可爱啊 2025-01-04 17:57:57

您可以使用 userFunc 代替 LookUpTable。

查看 realurl 手册

You can use a userFunc instead of the lookUpTable.

See realurl manual

最美的太阳 2025-01-04 17:57:57

这对我有用(TYPO3 6.1.7):

   'veranstaltung' => array(
      array(
        'GETvar' => 'tx_wsevents_wsevents[dates]',
        'lookUpTable' => array(
          'table' => 'tx_wsevents_domain_model_dates dates, tx_wsevents_domain_model_events events',
          'id_field' => 'dates.uid',
          'alias_field' => "CONCAT ( events.name, '_', DATE_FORMAT ( from_unixtime ( dates.startdate ),'%d-%m-%Y') )",
          'addWhereClause' => ' AND NOT dates.deleted AND ' . 'dates.events=events.uid',
          'useUniqueCache' => 1,
          'useUniqueCache_conf' => array(
            'strtolower' => 1,
            'spaceCharacter' => '-'
          )
        )
      )
    ),

This worked for me (TYPO3 6.1.7):

   'veranstaltung' => array(
      array(
        'GETvar' => 'tx_wsevents_wsevents[dates]',
        'lookUpTable' => array(
          'table' => 'tx_wsevents_domain_model_dates dates, tx_wsevents_domain_model_events events',
          'id_field' => 'dates.uid',
          'alias_field' => "CONCAT ( events.name, '_', DATE_FORMAT ( from_unixtime ( dates.startdate ),'%d-%m-%Y') )",
          'addWhereClause' => ' AND NOT dates.deleted AND ' . 'dates.events=events.uid',
          'useUniqueCache' => 1,
          'useUniqueCache_conf' => array(
            'strtolower' => 1,
            'spaceCharacter' => '-'
          )
        )
      )
    ),
时光瘦了 2025-01-04 17:57:57

我需要使用子查询。上面提到的 'table' => 方式'tableA a, tableB b' 没有返回任何值。

                    'lookUpTable' => array(
                        'table'               => '(
                                SELECT
                                    i.uid, k.objektart
                                FROM
                                    tx_wib24immobilien_domain_model_immobilie i
                                    JOIN
                                            tx_wib24immobilien_domain_model_objektkategorie k
                                        ON
                                            i.objektkategorie = k.uid
                            ) i',
                        'id_field'            => 'uid',
                        'alias_field'         => 'objektart',
                        ...
                    ),

I needed to use a subquery. The mentioned way with 'table' => 'tableA a, tableB b' did not return any value.

                    'lookUpTable' => array(
                        'table'               => '(
                                SELECT
                                    i.uid, k.objektart
                                FROM
                                    tx_wib24immobilien_domain_model_immobilie i
                                    JOIN
                                            tx_wib24immobilien_domain_model_objektkategorie k
                                        ON
                                            i.objektkategorie = k.uid
                            ) i',
                        'id_field'            => 'uid',
                        'alias_field'         => 'objektart',
                        ...
                    ),
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文