my question may seem trivial, sorry if it is! I am currently learning typo3 and typoscript. I want to create a template with a dynamic background image. This image is stored in a directory. I would like to get the image name from the table tt_content. However, the way this works confuses me a bit and i don't know if my take on it is the right one.
The code looks like this:
20 = CONTENT
20.table = tt_content
20.select{
where = pid = 79
}
20.headerImagePath = COA
20.headerImagePath {
10 = TEXT
10.stdWrap.field = image
10.stdWrap.wrap = <div class="background-media" style="background-image: url('|'); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; background-position: 50%;" data-start="background-position:50% 50%"
data-70-top-bottom="background-position:50% 70%">
</div>
}
I'd like to store the information about the image (the div part in the code) in a variable and put it into my template. The template part of my code looks like this:
<f:format.raw>{headerimage}</f:format.raw>
or
<f:cObject typoscriptObjectPath="headerimage" />
So my question would be, is the way i am selecting things from the database and storing into a variable correct and is the way i am calling them in the template correct? If the way above should work but i have some little errors, is it good practice or should i do things differently?
Kind Regards
Adi
to get header image as backgound us,its working also in multilanguage work with typo 6.x
thanks to http://www.derhansen.de/2013/02/using-fal-media-in-typo3-60-for-inline.html
your snippet will not work, because your structure is very wrong.
On
you try to create a new CONTENT OBJECT ARRAY on a CONTENT OBJECT.
This will not work.
But the CONTENT Object has a property called renderObj.
Look at following example:
UNTESTED
Try it like this:
Also look at this examples:
Here they get the header image directly from the MEDIA Element in the page properties:
http://wiki.typo3.org/TypoScript_Header_Image