News:

Wondering if this will always be free?  See why free is better.

Main Menu

help on style changer

Started by sadiqbaig, December 28, 2005, 05:19:29 AM

Previous topic - Next topic

sadiqbaig


this is wat i want 2do

in the default theme

i want 2put 3 .css files

such red.css , green.css n blue.css

n now i want that users can select it 4rm drop down menu

in default index page

btw i ave stylechanger script which changes font

stylechanger.php

<?php
$action 
$_GET["action"];

/* The list of towns on the road */
$sheets = array('small','medium','large','x-large');

/* Stand in the place where you live, now face north... */
$stylesheet $HTTP_COOKIE_VARS["stylesheet"];

if (!
$stylesheet) {$stylesheet 'medium';}

if (
$action == 'up' || $action == 'down') {
  
/*
  Think about direction, wonder why you have it now...
  If you want to go south but you're facing north, don't turn around.
  It's much easier to turn the world around.
  */
  
if ($action == 'down') {$sheets array_reverse($sheets);}
  
/*
  Walk to the next town,
  unless you're already at the end of the world.
  */
  
for ($i=0;$i<count($sheets);$i++) {
    if (
$sheets[$i] == $stylesheet && ($i+1) != count($sheets)) {
      
$stylesheet $sheets[$i+1];
      break;
    }
  }
  
/* Make a note of where you've got to */
  
setcookie('stylesheet'$stylesheettime()+31449600);
}
Header('Location: '.$_SERVER["HTTP_REFERER"]);
?>


   


index.php

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  <title>My Title</title>
  <link type="text/css" rel="stylesheet" href="default.css" />
  <?php
  $stylesheet 
$HTTP_COOKIE_VARS["stylesheet"];
  if (isset(
$stylesheet) && $stylesheet != 'medium') {
    echo 
'<link type="text/css" rel="stylesheet" href="/c/'.$stylesheet.'.css"/>';
  }
  
?>

  <link type="text/css" rel="alternate stylesheet" href="small.css" title="Small Text" />
  <link type="text/css" rel="alternate stylesheet" href="large.css" title="Large Text" />
  <link type="text/css" rel="alternate stylesheet" href="x-large.css" title="Extra Large Text" />
</head>
<body>
  <p>My lovely body text. Currently we are using
  <?
  if (isset($stylesheet) && $stylesheet != 'medium') {
    echo $stylesheet.'.css';
  } else {
    echo 'just the default stylesheet.';
  }
  ?>
  </p>
  Font Size:
  <a href="stylechange.php?action=up">Increase</a> |
  <a href="stylechange.php?action=down">Decrease</a>
</body>
</html>
   



n 3 css files such as

default , large , small n x-large

plz help

Advertisement: