We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25876
    • 79 Posts
    hey folks,
    I was wondering if it’s possible to address tv’s in css files.
    say, I’ve got a tv named "test" (text) with the value 100. Well, in HTML docs I get "100" with [*test*]; But in CSS, f.e. "width: [*test*]px;" does not work.

    How can I archive that?
    My content should be separated in 4 div’s, and they need to change width and background image on every main menu point ...
    Hope you can get me!

    Thanks a lot,
    Simon
      • 27708 MODX Staff
      • 2,502 Posts
      I’ve not tried this but I would think that in order to use a TV in a CSS file that the CSS file would have to be a MODx document and be called in your template head so that it would be parsed by the MODx parser.

      Traditionally if you include a link to the css file in the head of your template the CSS isn’t parsed because it is fetched by the HTML ouptut by MODx. If you have it as a MODx document you will be grabbing it via MODx and therefore all tvs, and other MODx tags will be parsed and then output to the browser.

      Hope this helps.

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 27708 MODX Staff
        • 2,502 Posts
        Well, that will work embarrassed

        1000 ways to do just about anything in MODx.
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 25876
          • 79 Posts
          fine, thank you guys!
          I’ll try it tomorrow but I can see the point wink

          PS: I posted this thread, went afk for eating a few minutes and when I got back -> 3 answers!
          I love that laugh