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

Stephan Schuler Stephan.Schuler at netlogix.de
Wed Aug 31 01:05:09 CEST 2011


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.


Kind regards,


Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de


--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Stra?e 53 | 90411 N?rnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht N?rnberg (HRA 13338)
Pers?nlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Gesch?ftsf?hrer: Stefan Buchta, Matthias Schmidt



________________________________________
Von: typo3-english-bounces at lists.typo3.org [typo3-english-bounces at lists.typo3.org]&quot; im Auftrag von &quot;Mark Roemermann [mark at nasaustralia.com.au]
Gesendet: Mittwoch, 31. August 2011 00:36
Bis: typo3-english at lists.typo3.org
Betreff: Re: [TYPO3-english] add style="background-image(); " with IMG_RESOURCE + LOAD_REGISTER?

Thanks guys for the suggestions.  Clearly I haven't had my zen moment
with typoscript yet.  ;)

With Jigals idea I have got it working now.

-- MarkR

On 31/08/2011 1:02 AM, Jigal van Hemert wrote:
> Hi,
>
> On 30-8-2011 15:36, Mark Roemermann wrote:
>> Hi list, I've been banging my head against a wall with this. Is there a
>> way to create a H1 tag that takes a page title and subtitle, and adds a
>> style attribute that is pulled from the page media?
>>
>> eg:
>>
>> <h1 style="background: url(page:media)
>> no-repeat;>page:title<span>page:subtitle</span></h1>
>
> Not the prettiest solution (I don't like splitting paired HTML tags over
> two properties), but it works:
>
> 10 = TEXT
> 10 {
> data = page:title
> innerWrap = |<span>{page:subtitle}</span>
> innerWrap.insertData = 1
> preCObject = IMG_RESOURCE
> preCObject {
> file {
> import = uploads/media/
> import.data = page:media
> import.listNum = 0
> height = 200
> width = 600
> }
> stdWrap.wrap = <h1 style="background: url(|) no-repeat;">
> }
> postCObject = TEXT
> postCObject.value = </h1>
> }
>
>

_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english


More information about the TYPO3-english mailing list