[TYPO3-english] Image Content Element as Body Background

JoH asenau info at cybercraft.de
Sat Jul 26 11:25:29 CEST 2014


Am 25.07.2014 18:17, schrieb Scotty C:> Hi,
 >
 > Thanks for your continued help. Let me clarify:
 > path/to/my/default/image.jpg won't work because I don't *have* a path to
 > the image. All I know is that it's going to be some image content
 > element that the use puts into the "left" column, from fileadmin. That's
 > why I was thinking get left.

Well - what I was trying to say is: You definitely *should* provide a 
fallback image this way, since otherwise the page won't have a 
background image at all unless somebody provided it by creating the 
image element. So it would be easy to upload an image to a desired path 
and use it as described. After that any image content element in the 
left column will override this default image.

Additionally it might be useful to implement a "content slide", so that 
images will be searched in left columns of the rootline pages as well. 
This way your editors won't have to provide an image for each and every 
page, but could provide images for a certain branch.

age.bodyTagCObject = TEXT
page.bodyTagCObject {
    value = path/to/my/default/image.jpg
    override.cObject = CONTENT
    override.cObject {
      slide = -1
      table = tt_content
      select {
        where = colPos = 1 AND CType = 'image'
        max = 1
      }
      renderObj = IMG_RESOURCE
      renderObj {
        #image setup here
      }
    }
    wrap = <body style="background-image:url(|);">
}

Some examples for "#image setup here" can be found here:
http://www.typo3.net/forum/thematik/zeige/thema/116048/
http://jweiland.net/typo3/typoscript/bild-aus-den-seiteneigenschaften-auslesen-ab-typo3-60.html
http://wissen.netzhaut.de/typo3/typoscript/hintergrundbild-und-fallback-auf-defaultsprache/
Sites might be German, but code examples should work anyway.

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-english mailing list