A-A+

Zencart设置后台单语言输入方法

2012年09月15日 灵犀一指 Zencart设置后台单语言输入方法已关闭评论 阅读 686 人 次

设置后台单语言输入方法
方法是:在后台把默认语言设置成英文,这样每次打开前台和后台默认都是英文。当安装了超过一个语言后,zen cart后台有切换语言的功能,切换到中文就行了。
问题是:当安装了超过一个语言后,zen cart模板后台的分类和商品的编辑页面会把各个语言的输入框都列出来,导致页面过长,无用信息过多,浪费输入资料的时间。
我们要实现:不管后台切换到中文还是英文,分类和商品的编辑页面只保留英文语言输入。
1,adminincludesconfigure.php里的最后面加入下面几行:
代码:[php]
define(‘ONLY_ONE_LANGUAGE_WHEN_EDITING’, true); //bbs.phpdz.cn
define(‘THE_LANGUAGE_WHEN_EDITING’, ‘en’);
//define(‘THE_LANGUAGE_WHEN_EDITING’, ‘gb’);[/php]
2,adminincludesheader.php里大概在18行,找到:
代码:[php]
$languages = zen_get_languages();[/php]
变为:
代码:[php]
$languages = zen_get_languages(false); //
3,adminincludesfunctionsgeneral.php里,找到:
代码:[php]
function zen_get_languages() {
global $db;
$languages = $db->Execute(“select languages_id, name, code, image, directory
from ” . TABLE_LANGUAGES . ” order by sort_order”);

while (!$languages->EOF) {
$languages_array[] = array(‘id’ => $languages->fields['languages_id'],
‘name’ => $languages->fields['name'],
‘code’ => $languages->fields['code'],
‘image’ => $languages->fields['image'],
‘directory’ => $languages->fields['directory']);
$languages->MoveNext();
}

return $languages_array;
}[/php]
变为:
代码:[php]
//blog.ctrol.cn
function zen_get_languages($only_one=ONLY_ONE_LANGUAGE_WHEN_EDITING) {
global $db;

if ($only_one){
$languages = $db->Execute(“select languages_id, name, code, image, directory
from ” . TABLE_LANGUAGES . ” where code=’” . THE_LANGUAGE_WHEN_EDITING . “‘”);
}
else{
$languages = $db->Execute(“select languages_id, name, code, image, directory
from ” . TABLE_LANGUAGES . ” order by sort_order”);
}
while (!$languages->EOF) {
$languages_array[] = array(‘id’ => $languages->fields['languages_id'],
‘name’ => $languages->fields['name'],
‘code’ => $languages->fields['code'],
‘image’ => $languages->fields['image'],
‘directory’ => $languages->fields['directory']);
$languages->MoveNext();
}
return $languages_array;
}
[/php]

标签:

评论已关闭!