Hello!
I want to use cookies on my site to control layout and theme.
I now have a functional index.php that will take the following passed to it...
index.php?themeselect=VALUEHERE&layoutselect=VALUEHERE
you can send either parameter, or none at all (none will cause a default to be used).
I want to write a "Setup" page where a user can look at screenshots of various combinations, etc, and select the ones they like using a form. Upon submitting the form, it should create a cookie on the client's machine with values assigned to the 2 variables. Upon re-visiting the site, it checks for the cookie and if found, uses the values within and aborts the "configured" selection.
for some reference on how it is currently working, here is how the 2 are setup now...
config.php
<?php
// This file config.php defines several internal items
// for index.php and it's includes.
//
// Theme Selection
if (!empty($_GET['themeselect'])) {
$themeselected = $_GET['themeselect'];
} else {
$themeselected = 'Orange';
//$themeselected = 'Blue';
//$themeselected = 'Dark';
//$themeselected = 'Brown';
}
// Layout Selection
if (!empty($_GET['layoutselect'])) {
$layoutselected = $_GET['layoutselect'];
} else {
$layoutselected = 'leftonly';
//$layoutselected = 'leftandright';
}
// Banner Alignment (based on layout)
if ($layoutselected == 'leftonly' ) {
$banneralign = 'left';
}
else {
$banneralign = 'center';
}
// Logo Selection ( in ./images/ )
$mainlogo = 'coleclan.net.logo3.gif';
//$mainlogo = 'ccpi_logo_tm_2005.gif';
// Theme Setup
if ( $themeselected == 'Orange' ) {
include 'orange.theme.php';
}
elseif ( $themeselected == 'Dark' ) {
include 'dark.theme.php';
}
elseif ( $themeselected == 'Blue' ) {
include 'blue.theme.php';
}
elseif ( $themeselected == 'Brown' ) {
include 'brown.theme.php';
}
else {
include 'orange.theme.php';
}
// Other configs...
?>
I will need to add in the "found a cookie, set these to this and go on" code within this file, but all of that cookie stuff i don't know.
this sounds simple to me, but i am likely wrong!
how do i go about doing this kind of thing?