[TYPO3] TemplaVoila and IMG_RESOURCE problem

Georg Großberger georg at grossberger.at
Sat May 12 10:05:59 CEST 2007


Georg Rehfeld schrieb:
> Hi group,
> 
> using TV in Typo3 V4.1 I'm trying to set an inline
> style="background-image:url(uploads/media/<xyz.jpg>);" but only get
> style="background-image:url();"
> 
> The essential template setup is as follows:
> 
> ----- snip -----
> ### get first picture from the media field
> temp.bild_b1 = IMG_RESOURCE
> temp.bild_b1 {
>   file.import = uploads/media/
>   file.import.field = media
>   file.import.listNum = 0
>   stdWrap.wrap = background-image:url( | );
> }
> 
> lib.bild_b1 < temp.bild_b1
> 
> page = PAGE
> page.typeNum = 0
> page.10 = USER
> page.10.userFunc = tx_templavoila_pi1->main_page
> ----- snap -----
> 
> The regarding TV DS XML is:
> 
> ----- snip -----
> <field_b1 type="array">
>     <type>attr</type>
>     <tx_templavoila type="array">
>         <title>Bild 1</title>
>         <sample_data type="array">
>             <numIndex index="0"></numIndex>
>         </sample_data>
>         <eType>TypoScriptObject</eType>
>         <eType_EXTRA type="array">
>             <objPath>lib.bild_b1</objPath>
>         </eType_EXTRA>
>         <TypoScriptObjPath>lib.bild_b1</TypoScriptObjPath>
>         <description>a.b1 style-Attribut</description>
>     </tx_templavoila>
> </field_b1>
> ----- snap -----
> 
> The mapping in the TO is set to the attribute 'style' and up to date,
> but the generated HTML output is only:
> 
> ----- snip -----
> style="background-image:url();"
> ----- snap -----
> 
> 
> For testing purposes I added this template setup:
> 
> ----- snip -----
> page.5 < lib.bild_b1
> ----- snap -----
> 
> and get, directly after the <body> tag, a line:
> 
> ----- snip -----
> background-image:url(uploads/media/garten04.jpg);
> ----- snap -----
> 
> 
> Conclusions:
> 
> - my template setup for lib.bild_b1 is correct, as can be seen from
>   the output of page.5, where the correct path to the image is spit
>   out
> 
> - my TV DS/TO/mapping seems to be OK: the wrap is generated and spit out
>   in the correct place ... inside the quotes of the style attribute
> 
> 
> But why is the path to the picture missing, when lib.bild_b1 is used in
> TV as opposed to being correctly generated in page.5 ???
> 
> Any help/hint is very welcome.
> 
> Thanks for your time and efforts, Georg

Which field do you mean with "media". If you want to to get the image in 
"field_b1" you should use something like

"import.current = 1"

or

"import.field = field_b1"


More information about the TYPO3-english mailing list