Jump to content

[SOLVED] Skin chooser


Zigster316

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.