Here is what you need to do,
first,
find the following in the global.php
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
echo $lang['no_settings'];
exit;
}
while ($row = $site_db->fetch_array($result)) {
$config[$row['setting_name']] = $row['setting_value'];
}
$site_db->free_result();
Then add the following
// registering global variable "user_template"
if (!isset($user_template))
session_register("user_template");
// check global variable for Empty
if ($user_template=="" || empty($user_template))
$user_template = $config['template_dir'];
// set the Template if QueryString is not nothing
if (!empty($t) || $t != "")
$user_template = $t;
$config['template_dir'] = $user_template;
it should look like this.
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
echo $lang['no_settings'];
exit;
}
while ($row = $site_db->fetch_array($result)) {
$config[$row['setting_name']] = $row['setting_value'];
}
[b]// registering global variable "user_template"
if (!isset($user_template))
session_register("user_template");
// check global variable for Empty
if ($user_template=="" || empty($user_template))
$user_template = $config['template_dir'];
// set the Template if QueryString is not nothing
if (!empty($t) || $t != "")
$user_template = $t;
$config['template_dir'] = $user_template;
[/b]
$site_db->free_result();
The second thing, I've created a new php page with two forms of drop down list, one form was for the languages, and the other was for the templates, then I included this page to every template's header file.
This is the new php file I've created.
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="640" align="center">
<tr>
<form>
<td width="50%" align="left">
<select name="select_template" onChange="javascript:if(options[selectedIndex].value!='0') document.location.href=options[selectedIndex].value; ">
<option value="0">Select a Template</option>
<?php
$t_link = $_SERVER['QUERY_STRING'];
$t_link = preg_replace("/&{0,1}l=[a-z\.]{1,25}/", "", $t_link);
$t_link = "?".$t_link;
$t_link = $_SERVER['PHP_SELF'].$t_link."&t=";
$folderlist = array();
$handle = opendir(ROOT_PATH."templates");
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."templates/$folder") && $folder != "." && $folder != ".." && $folder != "_vti_cnf" ) {
$folderlist[] = $folder;
}
}
closedir($handle);
foreach ($folderlist as $folder) {
$templink = $t_link.$folder;
?>
<option value="<?php echo $templink; ?>"><? echo $folder ?></option>
<?php
}
?>
</select>
</td>
</form>
<form>
<td width="50%" align="right">
<select name="select_language" onChange="javascript:if(options[selectedIndex].value!='0') document.location.href=options[selectedIndex].value; ">
<option value="0">Select a Language</option>
<?php
$l_link = $_SERVER['QUERY_STRING'];
$l_link = preg_replace("/&{0,1}l=[a-z\.]{1,25}/", "", $l_link);
$l_link = "?".$l_link;
$l_link = $_SERVER['PHP_SELF'].$l_link."&l=";
$folderlist = array();
$handle = opendir(ROOT_PATH."lang");
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/$folder") && $folder != "." && $folder != ".." && $folder != "_vti_cnf" ) {
$folderlist[] = $folder;
}
}
closedir($handle);
foreach ($folderlist as $folder) {
$langlink = $l_link.$folder;
?>
<option value="<?php echo $langlink; ?>"><? echo $folder ?></option>
<?php
}
?>
</td>
</form>
</tr>
</table>
Please do report bugs to me.
Good Luck