We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11421
    • 6 Posts
    is there a way to change an image loaded from the basic template file according to the page users browse?

    I mean, lets say i want to have the same template but with 3 different colors, one for news, one for articles, one for a blog.

    I clone the images and change only the color, so that’s everything looks same, except the color.

    how can I call the different .gif files, or even different css files according to the group of pages a user is browsing?

    am I asking 2 much?

    or should I clone the template and just assign a different template to each group of pages I want?


    • The easiest way to do this is to put a class on the body tag:

      <body class="news">

      then in your css, create the appropriate rules:

      body.news div#change-me { background-image: url(assets/images/one.gif); }

      No magic needed!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 11421
        • 6 Posts
        thnx a lot!