We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered TV in css

    • 38318
    • 128 Posts
    I have a homepage image which I would like a user to be able to change but it is set as a background image in the css
    background-image: url("../../images/banner.jpg");


    I have created a TV called homepageImage set it to the home template. I have then changed the code to
    background-image: url("../../images/[[*homepageImage]]");


    I have tried setting this in the external css and also using a css as a resource but everytime the image doesn't show. You don't seem to be able to give the TV access to a css resource.

    Is is possible to be able to do this? If so, where am I going wrong?

    This question has been answered by phil_w. See the first response.

      • 4172
      • 5,888 Posts
      the CSS-code has to be in the template, if you want MODX-tags to be parsed.
      If you have it in a CSS-file, which is loaded by the browser, no MODX-tags can be parsed, of course.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 35715
        • 59 Posts
        Yes, I do this all the time for exactly the same thing... Image TVs for background -image css....as Bruno says...just add the few required styles to the <head> of the template being used for those pages.
          • 38318
          • 128 Posts
          Thanks, adding to the <head> has fixed this for me.