使用realurl URL创建指向新闻标签的链接

时间:2014-12-02 15:22:30

标签: typo3 typo3-6.1.x realurl tx-news

我想使用来自realurl的网址创建tx_news所有标签的列表。

标签的RealURL配置:

'tag' => array(
                array(
                    'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
                    'lookUpTable' => array(
                            'table' => 'tx_news_domain_model_tag',
                            'id_field' => 'uid',
                            'alias_field' => 'CONCAT(title, "-", uid)',
                            'addWhereClause' => ' AND NOT deleted',
                            'useUniqueCache' => 1,
                            'useUniqueCache_conf' => array(
                                    'strtolower' => 1,
                                    'spaceCharacter' => '-'
                            )
                    )
                )
            ),

现在,列表以这种方式创建:

newsTags = CONTENT
    newsTags {
      table = tx_news_domain_model_tag
      select {
        pidInList = 1,298
        hidden = 0
        deleted = 0
        orderBy = title
      }
      orderBy = title
      renderObj = COA
      renderObj {
        wrap = |
        1 = LOAD_REGISTER
        1 {
            Counter.cObject = TEXT
            Counter.cObject.data = register:Counter
            Counter.cObject.wrap = |+1
            Counter.prioriCalc = intval
        }
        2 = TEXT
        2.insertData = 1
        2.field = title
        2.wrap = <li data-index="{register:Counter}"><a href="/labels/tag/|-
        3 = TEXT
        3.field = uid
        3.wrap = |">

        5 = TEXT
        5.field = title
        5.wrap = |</a></li>

      }
      wrap = <ul>|</ul>
    }

暂时忽略该注册表。使用Title-UID生成URL。有时标题中有一个点,然后URL不起作用。所以我很乐意使用URL realurl创建。这可能吗?

1 个答案:

答案 0 :(得分:2)

在您的解决方案中,您尝试手动构建链接。我强烈建议使用typolink来生成链接。如果RealURL可用且在RealURL配置中配置了相应的GET参数,则Typolink会生成语音URL。您只需为标记UID设置additionalParams

newsTags = CONTENT
newsTags {
    table = tx_news_domain_model_tag
    select {
        pidInList = 1,298
        hidden = 0
        deleted = 0
        orderBy = title
    }
    orderBy = title
    renderObj = COA
    renderObj {
        1 = LOAD_REGISTER
        1 {
            Counter.cObject = TEXT
            Counter.cObject.data = register:Counter
            Counter.cObject.wrap = |+1
            Counter.prioriCalc = intval
        }
        2 = TEXT
        2.field = title
        2.insertData = 1
        2.typolink {
            # link to current page
            parameter.current = 1
            # the current tag
            additionalParams = &tx_news_pi1[overwriteDemand][tags]={field:uid}
            additionalParams.insertData = 1
        }
        2.wrap = <li data-index="{register:Counter}">|</li>

    }
    wrap = <ul>|</ul>
}

您当然可以通过使用parameter = 999来区别设置目标页面。