We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Another way to go would be to use a separate mini-CSS file for each color, then use a snippet to inject the appropriate CSS file into the <head> of the template.

    The radio option TV Input Option Values would look like this:

    Red==red.css||Blue==blue.css||Green==green.css


    The snippet tag would go in the template:

    [!GetCss!]



    I'm not positive about the Evo snippet syntax, but it should be something like this:

    $cssFile = $modx->getTemplateVarOutput('CssTv');
    $modx->regClientCss(MODX_ASSETS_PATH . 'css/' . $cssFile);
    return "";

      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 22427
      • 793 Posts
      If the user has just to choose from severeal fixed images (that is, he should not be able to upload own pictures), you could give a class to <body> which is chosen by a TV [[*bg-class]].
      So in your template you would have
      <body class="[[*bg-class]]">

      The TV should be of type Radio Options, let's say with values bg1||bg2||bg3 .
      Then in your CSS file you would have the rules
      body.bg1 { background-image: url("assets/images/bg-image-1.png") }
      body.bg2 { background-image: url("assets/images/bg-image-2.png") }
      body.bg3 { background-image: url("assets/images/bg-image-3.png") }
      [ed. note: ottogal last edited this post 15 years, 1 month ago.]
      • discuss.answer
        • 22427
        • 793 Posts
        In the previous post I wanted to write
        which is chosen by a TV [ [*bg-class]]
        Here I inserted a blank between the [[ , obviously a MODX tag is not displayed - perhaps it is tried to be interpreted?
        Not so nice...