I have always wished that MODx posessed a tool to allow an end user some direct configuration control over their site. I realize that it is possible to grant users access to HTML chunks, but this is not within the comfort zone of most non-tech users. After playing around with it in our sandbox over the last few days I have found that it is not only possible, but relatively straight forward to create.
Create Template
In my sample site I created a template and called it Config. I then assigned it to my document ID of 1 and named my document Site Configuration. One by-product of using the number 1 document is that you will have to go to Tool/Configuration/Site and set you Site start to an ID of 2. I also unchecked Show in menu and Searchable in my number 1 document. With all of these points taken care of the config page should be well outside the ordinary flow of your site.
Create Template Variables
By utilizing a dedicated template we can now hook Template Variables (TV) into our document. Create your TVs and assign them to the Config template.
In the most straightforward sense you can use this for client controlled global information like telephone numbers and addresses, but after getting things going I realized you could also use a dynamic CSS document from within MODx (a later post) and allow the end user to control many of the design components of their site. I tested this out on things like a header image and background colors.
In my testing I was exclusively using the GetField snippet (see below) to call in my variables from within either my site template or from my dynamic CSS document:
background: [[GetField? &docid=`1` &field=`backgroundColor`]];
In this particular TV I used a DropDown List Menu to assign Hex codes to colors for example:
Red==#FF0000||Green==#00FF00||Blue==#0000FF
After putting all this together I did wonder if the addition of a color picker that generates Hex color codes might not be a nice addition to the Input Type of TVs in MODx? (I was reminded by Nick (MgrMgr dev) in the comments below that: “ManagerManager includes a color picker widget to allow you to pick any hex color value from a TV, if you want to expand it beyond a predefined list.”)
Clean It Up
Now, you can use the ManagerManager snippet to remove any extraneous fields from the Site Configuration document. In this example I removed all of them except my newly created TVs. Now, when my end user goes into their configuration they only see the appropriate configuration fields listed out: Telephone, Address, City, State, Zip, Background Color, Header Image, etc..


