We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16020
    • 43 Posts
    Hi, I am trying to create this website and the client would like to have a different background image for every page that fills the page.

    Would I create a Snippet, Chunk, or just hard code it in every page? And how would I ensure that it is different for every page?

    See www.klarsendesign.com/modx for the visual

    Thanks!
    • Create an image TV (no output widget selected, so the TV will just output the image filename). Then in the template head put a small <style...> block with something like this:
      body {background: url(assets/images/[*bgImageTV*]);}

      Or if you prefer, you could use inline css in the body tag:
      <body style="background: url(assets/images/[*bgImageTV*])">

      Now for each document you can just select the image desired for that page.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16020
        • 43 Posts
        Thanks! That was great and worked out perfectly. grin
          • 42010
          • 1 Posts
          Thanks for the simple solution.Even though i didnt understand about imageTV. But i used
          <body style="background: url(./images/james_white_ants.jpg) no-repeat">
          • Create an image TV in MODX and assign it to the template with the body tag variable as shown. Then, when you edit the resources you'll be able to select a new image for each page with the TV that you made.
              Frogabog- MODX Websites in Portland Oregon
              "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
              Having server issues? These guys have MODX Hosting perfected - SkyToaster