Background image on body tag with TypoScript

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 08:49:44

问题


I would like to assign every Page in TYPO3 Backend a Image. This image should be rendered as background image for my body tag, like.

<body style="background-image:url("/fileadmin/user_uploads/image.png")">

I have the version 6.2LTS of TYPO3. In a previous TYPO3 Version (4.5) i realized a smilar solution with this typoscript part

page.bodyTagCObject = COA
page.bodyTagCObject {
    10 = TEXT
    10.value = <body style="background-image:url(
    20 = TEXT
    20 {
        data = levelmedia: -1 "slide"
        wrap = uploads/media/ |
        listNum = 0
    }
    30 = TEXT
    30.value = );">
}

The new TYPO3 Version works with file references, so i'm not sure how can i realize this issue.

Have someone a hint?


回答1:


According to your question - yes 103 it's uid of the file reference, use this snippet to do what you want

page.bodyTagCObject = COA
page.bodyTagCObject {

  wrap = <body style="background-image:url('/|');">

  10 = FILES
  10 {
    references.data = levelmedia:-1,slide
    references.listNum = 0
    renderObj = TEXT
    renderObj.data = file:current:publicUrl
  }

}



回答2:


I use something similar on a Project, which runs TYPO3 v6.2.14.

You don't need the wrap since the filereference will give you the Path to the Image.

And slide doesnt need the quotation marks. Follwing Code should work:

 page.bodyTagCObject = COA
   page.bodyTagCObject {
        10 = TEXT
        10.value = <body style="background-image:url('
        20 = TEXT
        20 {
            data = levelmedia: -1, slide
        }
        30 = TEXT
        30.value = ');">
    }


来源:https://stackoverflow.com/questions/32568425/background-image-on-body-tag-with-typoscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!