问题
currently I'm using simplepoll.uid
to show a Poll on the Frontend :
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
}
is there a way to show automatically the last poll added to the storagePid instead of simplepoll.uid
?
回答1:
It could be that my solution does not work as there might be no stdWrap
support in the extension. Then you should ask the extension author to build in the wrapping (or support him with a pull request).
Requesting the uid from the last created poll should be possible with an SQL query which selects the highest uid.
An SQL query can be done in typoscript with the CONTENT
object:
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
}
}
}
You need no WHERE
clause to select no deleted and hidden records as these where inserted automatically.
Be aware to create polls in hidden mode otherwise an incomplete poll could be selected.
testing with
<f:cObject typoscriptObjectPath="lib.poll.settings.simplepoll.uid.cObject" />
or
page.1 < lib.poll.settings.simplepoll.uid.cObject
page.1.wrap = <h1>poll = [|]</h1>
来源:https://stackoverflow.com/questions/61157745/typo3-simplepoll-show-the-last