CrazyCoder
Member
Hi Basti, hi Mark !!!
So, i know this forum is about VisioList, but, as i started to talk about my project,
to code a visitors topsite skin changer,
i thought, you would not become angry after me,
if i put a new topic HERE, arfffff ooops )))
SO, its about my idea of a Aardwark Topsite visitors skin changer.
1) i put this at the beginning of the index.php :
2) i created this code.
Still index.php, AFTER :
I put this code i just created this morning :
re Oops , hihiiiiii first time its ok, index does refresh on submit and skin is changed
but after, oufff ouffffff i cant no more change the skin.
gonna find the bug, but am a few tired right now,
ITS JSUT A TEST ok ?
i wanted to share it with you , so Basti !!! maybe you are much much better than me,
lol, and you could look at my code and laugh a lot,
finding WHERE i could be mistaken, hihihiiiiii
See u later in the afternoon ....
Another ... Coffee Time !!!
yepaaaaaaaaaaaaaaaaaa
So, i know this forum is about VisioList, but, as i started to talk about my project,
to code a visitors topsite skin changer,
i thought, you would not become angry after me,
if i put a new topic HERE, arfffff ooops )))
SO, its about my idea of a Aardwark Topsite visitors skin changer.
1) i put this at the beginning of the index.php :
PHP:
<?php
$guest_skin = $_POST['stylesheet'];
Still index.php, AFTER :
PHP:
$CONF['skins_path'] = "{$CONF['path']}/skins";
$CONF['skins_url'] = "{$CONF['list_url']}/skins";
$TMPL['skins_url'] = $CONF['skins_url'];
$TMPL['list_name'] = $CONF['list_name'];
$TMPL['list_url'] = $CONF['list_url'];
// Combine the GET and POST input
$FORM = array_merge($_GET, $_POST);
############################################# BEGINING of NEXIA'S LANGUAGE HACK!
# here we create an array of the existing languages in the site:
$flagslist = '';
$langarray = array();
foreach(glob("languages/*.gif") as $langname)
{
# we generate the array
$langarray[] = $thislang = str_replace(array('languages/', '.gif'), '', $langname);
# then we create the value for the flag displayed on the site.
$TMPL['flagslist'] .= '<a href="'.$CONF['list_url'].'/index.php?setlang='.$thislang.'" title="'.$thislang.'"><img src="'.$langname.'" alt="'.$thislang.'" style="border:0;vertical-align:middle;" /></a> ';
}
# if the visitor click to choose a language, we set the cookie properly (if the file exists)
if(!empty($_GET['setlang']))
{
if(in_array($_GET['setlang'], $langarray))
{
setcookie("setlang", $_GET['setlang'], time()+360000);
$_COOKIE['setlang'] = $_GET['setlang'];
}
} # expire in 100 hour
# now we check if we have that cookie, replacing the default language with the cooked one!
$CONF['default_language'] = ($_COOKIE['setlang']) ? $_COOKIE['setlang'] : $CONF['default_language'];
################################################## END of NEXIA'S LANGUAGE HACK!
//##################################"""""
//determine the style
// Checks for, and assigns cookie to local variable:
if(!empty($_COOKIE['style'])) $TMPL['style'] = $_COOKIE['style'];
// If no cookie is present then set style as "day" (default):
else $TMPL['style'] = 'redblack';
// The language file
require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");
// Determine the category and skin
if (isset($FORM['cat']) && isset($CONF['categories'][$FORM['cat']])) {
$TMPL['skin_name'] = $CONF['categories'][$FORM['cat']];
}
else {
$TMPL['skin_name'] = $CONF['default_skin'];
}
PHP:
//################################# determine the guest skin
// determine the skin from DB
if (!is_dir("{$CONF['path']}/skins/{$TMPL['skin_name']}/") || !$TMPL['skin_name']) {
$TMPL['skin_name'] = $CONF['default_skin'];
}
/*
if (!is_dir("{$CONF['path']}/skins/{$CONF['default_skin']}/")) {
$TMPL['skin_name'] = 'fusion';
}
*/
if (!is_dir("{$CONF['path']}/skins/{$CONF['default_skin']}/")) {
$TMPL['skin_name'] = 'abstract';
}
//////////////////
//determine the guest skin
$TMPL['visitor_skin_list'] = '
</br /><br />
<div style="float:left;width:250px;height:50px;">
<p style="text-align:center;"><b>Choix du Skin</b></p>
<form method="post" action="index.php?guest_skin=stylesheet">
<select class="blackonwhite" name="stylesheet" size="1"
onchange="this.form.submit();">
<option value="abstract">abstract</option>
<option value="fusion">fusion</option>
</select>
<input type="hidden">
</form>
</div>
</br /><br />
';
// Checks for, and assigns cookie to local variable:
if(!empty($_COOKIE['guest_skin'])) {
if($TMPL['skin_name'] != $_COOKIE['guest_skin'])
$TMPL['skin_name'] = $_COOKIE['guest_skin'];
}
elseif(empty($_COOKIE['guest_skin'])) {
if(!empty($guest_skin)) {
setcookie("guest_skin", $guest_skin, time()+360000);
$CONF['default_skin'] = ($_COOKIE['guest_skin']) ? $_COOKIE['guest_skin'] : $CONF['default_skin'];
}
elseif(empty($guest_skin))
echo ""; // on garde le $TMLP['skin_name'] par defaut de la DB !!!
}
/////////////////// NEW CODE about SKIN_CHANGER
but after, oufff ouffffff i cant no more change the skin.
gonna find the bug, but am a few tired right now,
ITS JSUT A TEST ok ?
i wanted to share it with you , so Basti !!! maybe you are much much better than me,
lol, and you could look at my code and laugh a lot,
finding WHERE i could be mistaken, hihihiiiiii
See u later in the afternoon ....
Another ... Coffee Time !!!
yepaaaaaaaaaaaaaaaaaa