首页 > 解决方案 > TYPO3 : SimplePoll : 显示最后一个

问题描述

目前我正在使用simplepoll.uid在前端显示民意调查:

lib.poll = USER
lib.poll {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = Simplepoll
    pluginName = Polllisting
    vendorName = Pixelink
    settings =< plugin.tx_simplepoll.settings
    settings {
        simplepoll.uid = 13 // this is the ID of the Poll to show
    }
    persistence =< plugin.tx_news.persistence
    view =< plugin.tx_news.view 
}

有没有办法自动显示添加到 storagePid 而不是最后一次投票simplepoll.uid

标签: typo3

解决方案


可能是我的解决方案不起作用stdWrap,因为扩展中可能没有支持。然后您应该要求扩展作者构建包装(或通过拉取请求支持他)。

应该可以使用选择最高 uid 的 SQL 查询从上次创建的轮询中请求 uid。

可以使用CONTENT对象以印刷方式完成 SQL 查询:

lib.poll {
   settings {
      simplepoll.uid.cObject = CONTENT
      simplepoll.uid.cObject {
         table = tx_poll... // get the exact page name
         select {
            selectFields = uid
            pidInList = ??? // insert storage page of your polls
            orderBy = uid DESC
            max = 1            
         }
         renderObj = TEXT
         renderObj. field = uid
      }
   }
}

您不需要WHERE子句来选择不删除和隐藏的记录,因为这些记录是自动插入的。

请注意在隐藏模式下创建投票,否则可能会选择不完整的投票。


测试

<f:cObject typoscriptObjectPath="lib.poll.settings.simplepoll.uid.cObject" />

或者

page.1 < lib.poll.settings.simplepoll.uid.cObject
page.1.wrap = <h1>poll = [|]</h1>

推荐阅读