[TYPO3-english] add style="background-image(); " with IMG_RESOURCE + LOAD_REGISTER?

Mark Roemermann mark at nasaustralia.com.au
Wed Aug 31 04:02:14 CEST 2011


Thanks again guys, I've learnt a lot in a few messages

A little bit closer to my TYPO3 enlightenment XD

On 31/08/2011 9:10 AM, Christopher Torgalson wrote:
> Hi,
>
> On Tue, Aug 30, 2011 at 4:05 PM, Stephan Schuler
> <Stephan.Schuler at netlogix.de>  wrote:
>> Hi Mark.
>>
>>
>> I haven't tried it but it should go kind of this way:
>>
>>
>> 10 = TEMPLATE
>> 10 {
>>   template = COA
>>   template {
>>     10 = TEXT
>>     10.value = ##TITLE###
>>     20 = TEXT
>>     20.value = ###SUBTITLE###
>>     20.wrap =<span>|</span>
>>     wrap =<h1 ###BACKGROUND_STYLE###>|</h1>
>>   }
>>   marks {
>>     TITLE = TEXT
>>     TITLE.data = page:title
>>     SUBTITLE = TEXT
>>     SUBTITLE.data = page:subtitle
>>     BACKGROUND_STYLE = COA
>>     BACKGROUND_STYLE {
>>       10 = IMG_RESOURCE
>>       10.file {
>>         import.data = page:media
>>         import = uploads/media/
>>         import.listNum = 0
>>       }
>>       wrap = style="background: url(|) no-repeat;"
>>       ## put some "if" here to make ###BACKGROUND_STYLE### being an empty string if no background image is available if you wish
>>     }
>>   }
>> }
>>
>> That's not completely nice, too, but it keeps paired HTML tags together and avoids registers.
>> I usually create much more HTML around such a structure. Using a single wrap for a single pair of HTML tags enforces a well formed HTML output even on deeper nesting. You can replace this COA with several lines and wraps in it by a single TEXT element if it's as little HTML as here, of course.
>
>
> As a general approach, this gets my vote :)
>
> I had some reason for not using TEMPLATE when I dreamt up the TS
> sample I referred to, but I no longer remember it, so it probably was
> not a *good* reason. This has all of the advantages, but not the
> complexity.
>



More information about the TYPO3-english mailing list