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

Mark Roemermann mark at nasaustralia.com.au
Tue Aug 30 15:36:40 CEST 2011


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>

So far I've tried some variations on this code, but depending on how I
structure the load register it shows only the name of the register and
not the IMG-RESOURCE file path:

lib.pageTitle = COA
lib.pageTitle {

    # FROM CSC: Create style attribute for <H1> tag

    bgIMG = IMG_RESOURCE
    bgIMG {
      file.import = uploads/media/
      file.import.listNum = 0
      file.height = 200
      file.width = 600
      noTrimWrap = | style="background: url(|) no-repeat;"|
      }

    5 = LOAD_REGISTER
    5.headerStyle.cObject < bgIMG

    10 = TEXT
    10.dataWrap = <h1{register:headerStyle}>|<span>|</span></h1>
    10.data = page : title

    30 = TEXT
    30.data = page : subtitle
}

I'm still getting my head around typoscript and pulled this together
from looking at bits of CSC and some plugins, but I think I'm not using
the LOAD_REGISTER correctly...

Any ideas?

Cheers.


More information about the TYPO3-english mailing list