1

我在 TS 中做一种分页器......我正在做一个选择,但我需要配置(从 GP:var)开始(设置“开始”页面)值......但我不找到一种方法来做到这一点......

我一直在谷歌中寻找它,每个人都说它是一个 int+calc 对象......但是如果我不能在 calc 中设置一个变量,我就不明白成为一个 int+calc 的想法......

我给你一个我的代码示例

10.select {
    pidInList.insertData = 1
    pidInList = this
    max = 5
    begin = 0    #Here is where I would like to configure the begin dynamicaly with stdWrap or something like that
    orderBy = pages_smc_news.date DESC
    leftjoin = pages_smc_news ON(pages_smc_news.pid = pages.uid) LEFT JOIN tt_content ON (tt_content.pid = pages.uid)
    selectFields = pages_smc_news.date, title, bodytext, header,tt_content.pid
    where = header="teaser"
    andWhere = tt_content.sys_language_uid = 0
}
10.renderObj = COA
10.renderObj {
    ...
}
...
4

2 回答 2

0

也许您可以使用寄存器来存储和累积开始变量并覆盖它?每次我的代码将寄存器变量“num”与 1 相加时,它是一种 t3 cookie 变量,当您加载另一个页面时它会被删除。

  begin.stdWrap.cObject = COA
  begin.stdWrap.cObject {
       10 = LOAD_REGISTER
       10.num.cObject = TEXT
       10.num.cObject.data = register:num
       10.num.cObject.wrap = |+1
       10.num.prioriCalc = intval
  }
于 2011-12-06T16:12:55.787 回答
0

In TYPO3 4.5.x (maybe even in earlier versions) you can use markers property of the select. This lets you define markers (e.g. ###some_marker###) that you can use in other select properties.

10.select {
    pidInList.insertData = 1
    pidInList = this
    max = 5
    begin = ###begin###
    orderBy = pages_smc_news.date DESC
    leftjoin = pages_smc_news ON(pages_smc_news.pid = pages.uid) LEFT JOIN tt_content ON (tt_content.pid = pages.uid)
    selectFields = pages_smc_news.date, title, bodytext, header,tt_content.pid
    where = header="teaser"
    andWhere = tt_content.sys_language_uid = 0
    markers {
        begin = TEXT
        begin {
            data = GP:var
            intval = 1
        }
    }
}
于 2011-12-07T08:32:53.690 回答