Jump to content

Recommended Posts

Do you have different css files?

if you do put on the very top of your page

<?php
session_start();
?>

and in your head

<?php
echo "<link rel='stylesheet' type='text/css' href='{$_SESSION['theme']}' />"; ?>

and then for your drop down menu

<form name="theme_switcher" action="changetheme.php" method="GET">
<select name="theme_switcher">
<option value="blue" name="blue">Blue Theme</option>
<option value="green" name="green">Green Theme</option>
<option value="red" name="red">Red Theme</option>
</select>
</form>

and for your changetheme.php

<?php
session_start();
if(isset($_GET['red'])) {
$_SESSION['theme'] = 'red.css';
header("Location: http://www.yoursite.com/");
}else if(isset($_GET['green'])) {
$_SESSION['theme'] = 'green.css';
header("Location: http://www.yoursite.com/");
else if(isset($_GET['blue'])) {
$_SESSION['theme'] = 'blue.css';
header("Location: http://www.yoursite.com/");
}else
header("Location: http://www.yoursite.com/");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/66061-solved-skin-chooser/#findComment-330482
Share on other sites

made a mistake if no theme is set than you include no css file :P

change

<?php
echo "<link rel='stylesheet' type='text/css' href='{$_SESSION['theme']}' />"; ?>

to

<?php
if(isset($_SESSION['theme'])) {
echo "<link rel='stylesheet' type='text/css' href='{$_SESSION['theme']}' />";
}else
echo "<link rel='stylesheet' type='text/css' href='youmaintheme.css' />";
} ?>

Link to comment
https://forums.phpfreaks.com/topic/66061-solved-skin-chooser/#findComment-334515
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.