the following typoscript searches a random subpage and renders the first image which is referenced in the media field. It works. But i need a default image when the media field is empty.
page.10 = COA_INT
page.10 {
10 = CONTENT
10 {
table = pages
select {
orderBy = rand()
max = 1
pidInList = 34
}
renderObj = COA
renderObj {
5 = FILES
5 {
references {
table = pages
uid.data = current:uid
fieldName = media
}
begin = 0
maxItems = 1
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
}
}
}
}
}
I tried with
file = fileadmin/....
file.import.data = file:current:publicUrl
file.treatIdAsReference = 1
or
file.import.ifEmpty = fileadmin/....
or whith override but it seems that the whole FILES-Object is empty when there is no file in field media and so ifEmpty is not reached.
Can anybody give me a hint?
Edit: TYPO3 6.2
pgampe gave me the right hint - override or ifEmpty
have to start one level up:
5.stdWrap.ifEmpty.cObject = IMAGE
5.stdWrap.ifEmpty.cObject {
file = fileadmin/ .....
file.height = 200c
file.width = 200c
}