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

    we are developing a site with several different templates. We would like to give the CMS users the possibility to change the background-colour of the entire site. Is there a way to create some kind of global template variable that can be changed easily by the CMS users? Right now everything seems to be connected to pages, and not to the entire website.

    Olaf
      • 6726
      • 7,075 Posts
      Actually, it’s not connected to pages directly, TVs are associated to Templates and Templates are associated to a given document.

      If you need to change the background-color of the entire site, you could use the CSS as MODx document method and use a chunk you would make editable for your users (permissions have been upgraded and you can control this since 0.9.6). Then you insert your {{background-color}} chunk in your CSS document.

      Of course it’s not as flexible as using a TV, but you can’t use TV with the CSS as document method, since CSS document have a blank template (therefore you can’t associate a template to your TV).

      There are certainly other ways, either js (using mootools or jQuery to change the background-color, since you can manipulate CSS selectors with them... maybe create a background-color TV, and then add a js call in the header with the TV as parameter) or php (a little snippet I guess could work).

        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 22098
        • 218 Posts
        thanx...did anyone ever create a colour-picker widget for MODx?

        Olaf
          • 6726
          • 7,075 Posts
          Not to my knowledge, widgets are quite under-used for the moment, but I like the idea smiley
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 17883
            • 1,039 Posts
            thanx...did anyone ever create a colour-picker widget for MODx?
            You mean like the calendar popup for picking up a date?
              • 22098
              • 218 Posts
              yup!