Ok.. I'm about to go home from work and wont be able to play with this for awhile but:
Code:
if( $HTTP_GET_VARS['skin']){
setcookie('skin', $HTTP_GET_VARS['skin']);
}
if(( $HTTP_COOKIE_VARS['skin'] == 2) || ( $HTTP_GET_VARS['skin'] == 2)){
$smarty->template_dir = BASEDIR.DIRECTORY_SEPARATOR."skin2";
$smarty->compile_dir = BASEDIR.DIRECTORY_SEPARATOR."templates2_c";
$smarty->config_dir = BASEDIR.DIRECTORY_SEPARATOR."skin2";
$smarty->cache_dir = BASEDIR.DIRECTORY_SEPARATOR."cache2";
$smarty->secure_dir = BASEDIR.DIRECTORY_SEPARATOR."skin2";
$smarty->debug_tpl="file:debug_templates.tpl";
$smarty->assign("ImagesDir","../skin2/images");
$smarty->assign("SkinDir","../skin2");
} else {
$smarty->template_dir = BASEDIR.DIRECTORY_SEPARATOR."skin1";
$smarty->compile_dir = BASEDIR.DIRECTORY_SEPARATOR."templates_c";
$smarty->config_dir = BASEDIR.DIRECTORY_SEPARATOR."skin1";
$smarty->cache_dir = BASEDIR.DIRECTORY_SEPARATOR."cache";
$smarty->secure_dir = BASEDIR.DIRECTORY_SEPARATOR."skin1";
$smarty->debug_tpl="file:debug_templates.tpl";
$smarty->assign("ImagesDir","../skin1/images");
$smarty->assign("SkinDir","../skin1");
}
Not being a php guru is there a way to use a switch statement to make this cleaner/add more skins easier?
Also, there is the problem of switching back to the 1st skin, when the cookie is set to skin2 and you put a ?skin=1, the cookie is updated but skin2 shoews till you hit refresh because of :
Code:
if(( $HTTP_COOKIE_VARS['skin'] == 2) || ( $HTTP_GET_VARS['skin'] == 2)){
I assume it reads the cookie (2) before it sets the cookie (1)? Or it reads the cookie (2) caches the value then the page runs?
Again, this just shows how little I know of php.
Going to do some looking, but any help is apprecieated.