[TYPO3-dev] TypoScript DataProcessors
Björn Lindner
info at netz-giraffe.de
Mon Nov 21 18:51:04 CET 2016
Hey folks,
I have the following bit of TypoScript to retrieve a target page's page resources (i.e. imaes in different dimensions) for a custom teaser element I have made.
dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
dataProcessing.10 {
# Notes:
# The following piece takes the pid of the teaser's related_page
# and sets it as the pidInList setting.
# After that the sql query is extended by looking up the uid which is related_page.
# then, all image variants are fetched and assigned to a variable.
# thus, there is no need for a controller just to get a target page's image assets
table = pages
pidInList {
dataWrap = DB:pages:{field:related_page}:pid
wrap3 = {|}
insertData=1
}
#where.data = 1831
orderBy = sorting
where.dataWrap = uid={field:related_page}
as = relatedPageMediaArray
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media_normal
as = mediaNormal
}
20 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
20 {
references.fieldName = media_skyscraper
as = mediaSkyscraper
}
30 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
30 {
references.fieldName = media_wide
as = mediaWide
}
40 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
40 {
references.fieldName = media_header
as = mediaHeader
}
}
this works perfectly if I only want to retrieve assets from one target page. Let's assume I have multiple pages from where I want to get assets (image 364, 899,574 are stored in the database as the respective page UIDs via a comma separated list).
How would I have to modify the TS in order to process the list of page IDs first (I wanted to go with the Split Processor) and then iterate over the array of IDs i just got from the Split Processor?
nesting another DatabaseQueryProcessor inside the SplitProcessor did not work, unfortunately.
Thanks in advance.
More information about the TYPO3-dev
mailing list