1
Mods & Plugins (Requests & Discussions) / Gibt es
« on: June 26, 2003, 05:05:04 PM »
wirklich keine Möglichkeit? Oder gibt es einen "Experten", den ich direkt anschreiben könnte?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
yes, u were right, Jan, I changed "get" to "post" and now it works perfectly with drop down form!
here is full working code:Code: [Select]$query_string = '';
if (!empty($HTTP_GET_VARS)) {
foreach ($HTTP_GET_VARS as $key => $val) {
if ($key != "l") {
$query_string .= ($query_string != '' ? '&' : '?').$key."=".$val;
}
}
}
// We add the session id with "&" not "&"
$lang_url = $site_sess->url($PHP_SELF.$query_string, '&');
// Now we can better remove the "l" parameter
$lang_url = preg_replace("/[?|&]l=[^?|&]*/", "", $lang_url);
// We replace "&" with "&" to make it valid XHTML
$lang_url = str_replace("&", "&", $lang_url);
$lang_select = "<form action=\"".$lang_url."\" method=\"post\">\n";
$lang_select .= "<select class=\"select\" name=\"l\" onChange=\"submit()\">\n";
// Now we open the "lang" folder, read out all available languages
// and add it as options to the dropdown.
$handle = opendir(ROOT_PATH."lang");
while ($folder = @readdir($handle)) {
if (@is_dir(ROOT_PATH."lang/".$folder) && $folder != "." && $folder != "..") {
$lang_select .= "<option value=\"".$folder."\"";
// If the folder name matches the current language,
// show the option as selected
if ($folder == $config['language_dir']) {
$lang_select .= " selected=\"selected\"";
}
$lang_select .= ">".$folder."</option>\n";
}
}
$lang_select .= "</select>\n</form>";
// Register the dropdown code for the template engine
$site_template->register_vars("lang_select", $lang_select);