Alidad Posted April 29, 2009 Share Posted April 29, 2009 Hi, does any one know how can change templates color by using button to change template1 For sample Yahoo.com where you see drop menu on the top right site where it said "page options" then showing few color button and select one fo those color button then will change templates to that color you picked. does any one know where i could find how to change that color templates using php and css! please help thanks. AM Quote Link to comment https://forums.phpfreaks.com/topic/156158-change-color/ Share on other sites More sharing options...
Ken2k7 Posted April 29, 2009 Share Posted April 29, 2009 It's just a change in the CSS I think. Quote Link to comment https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822046 Share on other sites More sharing options...
mattal999 Posted April 29, 2009 Share Posted April 29, 2009 Here are some basic instructions: 1) Make each template using CSS, call them something like red.css and blue.css. 2) Make a new PHP script that retrieves a variable like $_GET['color'] and sets a cookie with this value that will almost never expire. 3) On the template page, make a option box that redirects to the new PHP script with a GET variable of color=Option box value, then in the stylesheet include, do a check for the cookie and insert the relevant stylesheet, for example <?php echo $_COOKIE['color']; ?> Vague, but will work. Quote Link to comment https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822049 Share on other sites More sharing options...
ignace Posted April 29, 2009 Share Posted April 29, 2009 Check: http://www.alistapart.com/articles/alternate/ or look for css switcher on google this option has an instant effect so you do not need to reload the page for it to work Quote Link to comment https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822056 Share on other sites More sharing options...
rhodesa Posted April 29, 2009 Share Posted April 29, 2009 or, in your CSS you can use a parent class, and change it with JavaScript <html> <head> <style type="text/css"> .redTemplate h1 { color: red; } .blueTemplate h1 { color: blue; } .greenTemplate h1 { color: green; } </style> </head> <body class="redTemplate"> <h1>Here is my title</h1> <select onChange="document.body.className=this.value"> <option value="redTemplate">Red Template</option> <option value="blueTemplate">Blue Template</option> <option value="greenTemplate">Green Template</option> </select> </body> </html> you can then expand on that, setting a cookie to remember the selected template Quote Link to comment https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822061 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.