[TYPO3-english] random images with TS - how to preventduplicates?
Paul Vetch
paul.vetch at kcl.ac.uk
Sun Mar 20 11:39:24 CET 2011
Just for reference - as usual, made heavy weather of a simple situation for
a bit of CONTENT TypoScript. I already had the fields I needed from the
query - may as well just handle them in the renderObj of the same piece of
TS. I've pasted the TS below and some useful references:
[1] http://www.typo3.net/forum/beitraege/sonstiges-2/104073/ - some useful
SQL code for working with DAM
[2]
http://www.typo3wizard.com/en/articles/explaining-the-content-object.html -
good examples for using the CONTENT cObject
lib.imageFeature = CONTENT
lib.imageFeature {
wrap= <ul class="img">|</ul>
table = tx_dam
select {
pidInList = 1
# apply a join to filter by category
join = tx_dam_mm_cat ON (tx_dam_mm_cat.uid_local = tx_dam.uid AND
tx_dam_mm_cat.uid_foreign = 1)
orderBy = RAND()
max = 5
selectFields = title, file_name, file_path, copyright, description
}
renderObj = COA
renderObj {
5 = IMAGE
5 {
file.import.dataWrap = {field:file_path}{field:file_name}|
file.maxW = 125
file.width=125
file.height=80c
file.width.override = 125
file.height.override = 80c-75
# DAM title, copyright - any fields in the select all available for use.
titleText.data = field:title
### [...] etc etc, normal IMAGE config.
}
}
}
Best
Paul
"Christopher Torgalson" wrote in message
news:mailman.12266.1298837943.648.typo3-english at lists.typo3.org...
Hi,
On Sun, Feb 27, 2011 at 9:27 AM, Steffen Kamper <info at sk-typo3.de> wrote:
> Hi,
>
> only chance i see is to put outputted images in a register and include it
> in
> andWhere for exclusion.
Alternatively (this would require you to totally rewrite your TS!) you
could select all five images, randomly sorted, in the same query and
then just render them in order.
--
Christopher Torgalson
http://www.typo3apprentice.com/
More information about the TYPO3-english
mailing list