Author Topic: any php coders? ((;  (Read 32194 times)

0 Members and 1 Guest are viewing this topic.

Offline Bellissima

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
any php coders? ((;
« Reply #15 on: February 27, 2003, 11:50:16 AM »
Quote from: V@no
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);


Welche Dateien muss ich hierfür ändern und an welche Stelle muss ich den neuen Code einfügen? Das ist mir noch nicht klar....