PDA

مشاهدة نسخة كاملة : [4images] لعمل قائمة إختيار اللغة


Zhra
19-11-2006, 11:18 AM
لعمل قائمة منسدلة لأختيار اللغة في مكتبة الصور 4images

1-افتح ملف
/includes/page_header.php
أبحث عن النص التالي وضع وقبله النص اللاحق (تأكد قبل هذا النص) http://www.zhra.net/vb/images/icons/icon29.gif

$site_template->register_vars(array(
"media_url" => MEDIA_PATH,
"thumb_url" => THUMB_PATH,


الكود المطلوب إضافته

$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);



2- الان إذهب للقالب المستخدم لديك في مكتبة الصور ثم افتح ملف home.html
/templates/<yourtemplate>/home.html

و أضف هذه الجملة في أي مكان تريد أن تظهر القائمة المنسدلة به
{lang_select}

الموضوع الاصلي (http://www.4homepages.de/forum/index.php?topic=47 43.60) من منتدى الدعم الفني . . . . أنتهى