We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16532
    • 38 Posts
    I have a TVs - contentbg, to specify background image for each document.
    All documents have their own background image but only one template.
    How can I do this?

    Please advise.
      • 3707
      • 241 Posts
      One way to do this is create a TV (e.g. bgImage) with a list of image names using the "DropDown List Menu" input type.

      In the template, add an ID attribute to the body tag that references the TV.
      <body id="[*bgImage*]">

      Assign a background image to each document.

      In your CSS file, create a rule for each background image.
      body#image1 {
      	color: #fff;
      	background: #000 url(images/image1.jpg) no-repeat center top;
      	}

      If you have a lot of documents therefore lots of background images, your CSS file could end up too large so you’d be better off creating a snippet.
        • 29525
        • 388 Posts
        How about this?

        Insert this in the head directly (or in a chunk)

        <style>
        body {background-image: url(../../[*background*]); }
        </style>

        Create a TV with image widget. Then for each document select/navigate to the desired image in the image folder.

        I realize the style should be in a separate css file rather than in the head directly. . .
          www.terrybarthdesign.com