Altering site HTML based on user selection

They have: 4 posts

Joined: Sep 2001

If anyone could give me PHP code on how to do this, I would be very grateful. I'm making a site for my company, and their breathing down my back. Just send it to the following e-mail:

[email protected]

Thanks!!

They have: 4 posts

Joined: Sep 2001

An example of this is http://www.jedilegacy.net

They have: 71 posts

Joined: Aug 2001

This is actually quite a simple code, if your running templates in PHP then set all of the colours as variables like this: "> right then down to the code...

<?php
if ($usr_select == "red")  {

         
// Set the variables
         
$font_color1 = FFFF00;
         
$table_bgcolor1 = FF0000;

         
// Include your header to the page
         
include("header.php");

         
// Include the pages main content
         
include("about.php");

         
// Include the footer to the page
         
include("footer.php");

}

elseif (
$usr_select == "blue")  {

         
// Set the variables
         
$font_color1 = 00ADDD;
         
$table_bgcolor1 = 000080;

         
// Include your header to the page
         
include("header.php");

         
// Include the pages main content
         
include("about.php");

         
// Include the footer to the page
         
include("footer.php");

}

else  {

         
// The plain background of the site, defaults

          // Set the variables
         
$font_color1 = 000000;
         
$table_bgcolor1 = FFFFFF;

         
// Include your header to the page
         
include("header.php");

         
// Include the pages main content
         
include("about.php");

         
// Include the footer to the page
         
include("footer.php");

}
?>

If you wanted to use the content inside the script..it would be a long long script. But here's how you would go about doing it, in the if/elseif commands do something like this;

if ($page == "about" && $usr_select == "red") {

// All your PHP stuff here

// Underneath all that add some content in HTML

?>
MY HTML PAGE
<?php

include("footer.php");

}

Get it?

They have: 4 posts

Joined: Sep 2001

Thanks!!

They have: 71 posts

Joined: Aug 2001

Quote: Originally posted by master7
Thanks!!

no problem Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.