[TYPO3] Displaying Content Elements with custom query in the template
Stefan Ernst
erwachsene at thxbye.de
Mon Jun 16 00:29:31 CEST 2008
Hola,
I've been having quite some difficulties with getting content elements
to display in the way I want to through Template's TS, the scenario is
as follows:
I have a custom field in the database for content I'm using with an
extension to specify when (I'm rotating even/odd minutes for a test) a
certain element is to be displayed.
Now, to honour that setting I have to change the select portion in the
template outputting the content elements and it works fine, except for
one "small" thing:
It displays the content elements from ALL pages, not only the current
one - which, of course, is pretty unacceptible for production use, it
seems to "forget" the part of the MySQL query limiting selection of
elements to the current page.
Here is the code:
--------------------------------------
page = PAGE
page.10 = TEMPLATE
page.10 {
template = FILE
template.file = fileadmin/resources/template/main.html
workOnSubpart = DOKUMENT
marks.INHALT = CONTENT
marks.INHALT {
table = tt_content
select.pidInList = this
select.orderBy = sorting
}
}
[minute =
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58
]
page.10.marks.INHALT.select.where = tx_ideamanorotmenu_rotation_menu=1
OR tx_ideamanorotmenu_rotation_menu=0 AND colPos=0
[minute =
1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59
]
page.10.marks.INHALT.select.where = tx_ideamanorotmenu_rotation_menu=2
OR tx_ideamanorotmenu_rotation_menu=0 AND colPos=0
[global]
--------------------------------------
Short explanation:
If tx_ideamanorotmenu_rotation_menu is 1, it should be displayed only
when the current time's minute is even.
If tx_ideamanorotmenu_rotation_menu is 2, only when it's odd and
if tx_ideamanorotmenu_rotation_menu is 0, it should be displayed in
either case (to make "global" elements for both even and odd minutes).
Does anybody have an idea on how to fix this?
I've read about "select.pidInList = this" supposedly taking care of
it, but in my case it simply doesn't - am I maybe using it wrong?
Thank you very much for any help or hints,
take care,
Stefan.
More information about the TYPO3-english
mailing list