Totally Zenned
- Join Date:
- Jan 2004
- Location:
- N of San Antonio TX
- Posts:
- 9,906
- Plugin Contributions:
- 23
How about controlling a site's color(s) with the database?
It's been around for a long time. The ability to insert variables into stylesheets (.css), that is. Over eight years ago the idea of "variable" in CSS was discussed.
It seems to be fairly easy to accomplish. One simply renames a stylesheet to .php vs .css. It's still listed as a stylesheet.```
<link rel='stylesheet' type='text/css' href='css/colorstyle.php' /> ``` In the colorstyle.php file, the first line would re-establish the main purpose of the file by stating``` </php header("Content-type: text/css; charset: UTF-8"); ?> ``` Then, the code would establish colors of the site. If one were using the Color Change mod, there would be nine colors to establish.``` </php header("Content-type: text/css; charset: UTF-8"); $warningColor1 = "#CC3333"; $warningColor2 = "#CC6600"; $mainColor1 ="#6699CC"; $mainColor2 ="#99CCFF"; $mainColor3 ="#CCFFFF"; $formColor1 ="#DCDCDC"; $formColor2 ="#EEEEEE"; $textColor1 ="#FFFFFF"; $textColor2 ="#000000"; ?> ``` Then, in the same file, you would continue on with the insertion of variables using some PHP``` #MainWrapper {background-color: <php echo $mainColor3; ?>;} ``` Of course, the next logical step would be to allow the site owner to place these selections in the database through a menu in the admin. Then, the file would run a query on the database to find the colors and assign them to their variable.I'm thinking of this as a replacement for the Classic and Template Default that would allow quicker up time for new users. One could even add a transparency level in the Admin form for rgba submission.
Of course the user can still go to specific spots in the file and "adjust" at will.
Thoughts?
Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com