We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21736
    • 4 Posts
    1. I'm looking for some sort of a color theme switcher, where I can change the entire site's color scheme, ranging from text, buttons to form elements and what not. Clients should not be able to access this, only superadmins.

    2. I'm looking to build some sort of a repsponsive template or use skeletone etc. but I want to be able to switch sidebars from left to right, change the location of the navigation basically change the layout of major sections in the site all from the backend. Even if this means building a couple of different template but ideally I want to have one code base.

    Thanks!
      • 14214
      • 299 Posts
      How are you CSS files setup? If you have one for layout and another for colors, it would be possible to set a TV-value for color that specifies a color specific CSS. Or you could make a few templates.

      Can you give some more detail to the frequency of changes, are you looking to make the changes based on a certain event....?
        • 40944
        • 78 Posts
        You could create a system setting entry?

        You could use it to switch styles (systemsetting with the filename of the stylesheet), but also set values and use them inside a stylesheet resource: create a stylesheet resource you can edit inside the manager and use systemsettings or less/sass variables to make it easier to edit (there are extra's that can compile less/sass files).
          • 3749
          • 24,544 Posts
          You could also make it a User Setting if the users are logged in and you want them to be able to set the color as a preference.
            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
            • 21736
            • 4 Posts
            Thanks. I haven't setup anything. I come from an EE environment and just want to see what's possible.

            I'm trying to cater for a market that doesn't have the budget for custom designs.

            So first I want to be able to choose a colour theme via the back end, the client will never have access to this.

            Secondly I want to be able to change the layout of the pages via the backend, either by drag and drop, or just templates. Again the client won't have access to this.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The easiest way is to use a radio button TV that will return a value that you will use in the template's stylesheet link.
              <link rel="stylesheet" type="text/css" href="assets/templates/css/[[*color]].css">

              You can change layouts by adding a classname to the body tag, again with a TV, to indicate the type of layout, then use specific CSS directives to show/hide/position the various sections of the template.

              Alternatively, you can have three or four templates, one for each layout type, and assign resources to these templates as desired.

              You can use access control permissions to control which of your Manager users can see the TVs or edit the templates.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 40944
                • 78 Posts
                Quote from: sottwell at Jan 12, 2014, 01:50 PM
                The easiest way is to use a radio button TV that will return a value that you will use in the template's stylesheet link.
                <link rel="stylesheet" type="text/css" href="assets/templates/css/[[*color]].css">

                You can change layouts by adding a classname to the body tag, again with a TV, to indicate the type of layout, then use specific CSS directives to show/hide/position the various sections of the template.

                Alternatively, you can have three or four templates, one for each layout type, and assign resources to these templates as desired.

                You can use access control permissions to control which of your Manager users can see the TVs or edit the templates.
                But that would involve setting it for each page? I'd say a system setting would be better, because that would require just a few clicks for the entire site. And no extra access control permissionshave to be set.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  You mean these changes will be for the entire site, not just for various pages? Then of course system (or context) settings can be used. Just create the new system setting, and use [[++site_color]] in your stylesheet link.

                  Perhaps a more appropriate method would be to use something like LESS for your CSS file management. MODX resources can be .css, so I would use Static Resources for this. http://modx.com/extras/package/lesscss [ed. note: sottwell last edited this post 12 years, 8 months ago.]
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org