Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/156158-change-color/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822049
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/156158-change-color/#findComment-822061
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.