[TYPO3-english] Image Content Element as Body Background

JoH asenau info at cybercraft.de
Fri Jul 25 13:10:06 CEST 2014


Am 24.07.2014 20:25, schrieb Scotty C:
> Hi,
>
> First and foremost, thanks for the quick reply! Unfortunately that won't
> work because I don't have an exact path. All I know is, the user will
> pick "some" image from fileadmin and place it in the left column as an
> image content element.
>
> Can we tweak something to still make your suggestion work?

No need to tweak it, since that is exactly what the code is supposed to do.
The "value" of the TEXT is just necessary to have a fallback in case 
there is no image element at all.

The rest is exactly the same as if you had used 
"styles.content.getLeft", with just one difference: The renderObj 
defines how to handle the image element in your case, since you don't 
want to get an <img> tag there.

To avoid other content types being considered, you could just modify it 
a bit though:

page.bodyTagCObject = TEXT
page.bodyTagCObject {
    value = path/to/my/default/image.jpg
    override.cObject = CONTENT
    override.cObject {
      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(|);">
}

Still "Image setup here" depends on the method you are using to upload 
and save the image, since there are different ways to deal with images 
in the currently supported TYPO3 versions.

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