此次美化插件,可以实现论坛名称、栏目和导航中英文分离,整合了后台中英文管理,具体效果
请访问演示网站 http://www.enfans.net
(此插件的使用的模板结构为 templates/chinese目录为中文风格,templates/english目录为英文风格, admincp.lang.php只存在于templates/default目录下)
1. 升级数据库
分四次,一次一行
- alter table cdb_forums add name2 char(255) not null default '';
- alter table cdb_forums add description2 char(255) not null default '';
- insert into cdb_settings values('bbname2', '');
- insert into cdb_settings values('sitename2', '');
复制代码
2. 修改admin/global.php
寻找
- echo $dot[$id]."<a href="$url" target="_blank"><b>$forum[name]</b><span class="smalltxt">$hide</a> - ".$GLOBALS['lang']['display_order'].": <input type="text" name="order[{$forum[fid]}]" value="$forum[displayorder]" size="1">".
复制代码
修改为
- echo $dot[$id]."<a href="$url" target="_blank"><b>$forum[name]/$forum[name2]</b><span class="smalltxt">$hide</a> - ".$GLOBALS['lang']['display_order'].": <input type="text" name="order[{$forum[fid]}]" value="$forum[displayorder]" size="1">".
复制代码
3. 修改templates/default/admincp.lang.php
- 修改 'forums_cat_name' => '分类英文名称:',
- 增加 'forums_cat_name2' => '分类中文名称:',
- 修改 'forum_edit_description'=>'论坛英文简介:',
- 增加 'forum_edit_description2'=>'论坛中文简介:',
- 修改 'forums_edit_description_comment' => '将显示于论坛名称的下面,提供对本论坛的简短英文描述',
- 增加 'forums_edit_description2_comment' => '将显示于论坛名称的下面,提供对本论坛的简短中文描述',
- 修改 'forums_edit_name' => '论坛英文名称:',
- 增加 'forums_edit_name2' => '论坛中文名称:',
- 修改 'settings_bbname' => '论坛英文名称:',
- 增加 'settings_bbname2' => '论坛中文名称:',
- 修改 'settings_sitename' => '网站英文名称:',
- 增加 'settings_sitename2' => '网站中文名称:',
- 修改 'settings_bbname_comment' => '论坛英文名称,将显示在导航条和标题中',
- 增加 'settings_bbname2_comment' => '论坛中文名称,将显示在导航条和标题中',
- 修改 'settings_sitename_comment' => '网站英文名称,将显示在页面底部的联系方式处',
- 增加 'settings_sitename2_comment' => '网站中文名称,将显示在页面底部的联系方式处',
复制代码
4. 修改admin/forum.php
寻找
- $modsorig = $comma = '';
- $query = $db->query("SELECT fid, type, status, name, fup, displayorder, moderator FROM $table_forums ORDER BY displayorder");
复制代码
修改为
- $modsorig = $comma = '';
- $query = $db->query("SELECT fid, type, status, name, name2, fup, displayorder, moderator FROM $table_forums ORDER BY displayorder");
复制代码
寻找
- showtype("$lang[forums_detail] - $forum[name]", 'top');
复制代码
修改为
- showtype("$lang[forums_detail] - $forum[name]/$forum[name2]", 'top');
复制代码
寻找
- showsetting('forums_edit_name', 'namenew', $forum['name'], 'text');
复制代码
下面增加
- showsetting('forums_edit_name2', 'namenew2', $forum['name2'], 'text');
复制代码
寻找
- showsetting('forums_edit_description', 'descriptionnew', $forum['description'], 'textarea');
复制代码
下面增加
- showsetting('forums_edit_description2', 'descriptionnew2', $forum['description2'], 'textarea');
复制代码
寻找
- showsetting('forums_cat_name', 'namenew', $forum['name'], 'text');
复制代码
下面增加
- showsetting('forums_cat_name2', 'namenew2', $forum['name2'], 'text');
复制代码
寻找
- $db->query("UPDATE $table_forums SET type='$typenew', status='$statusnew', fup='$fupnew', name='$namenew', icon='$iconnew',
- description='$descriptionnew', styleid='$styleidnew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew',
- allowimgcode='$allowimgcodenew', allowsmilies='$allowsmiliesnew', postcredits='".intval($postcreditsnew)."',
- replycredits='".intval($replycreditsnew)."', password='$passwordnew', viewperm='$viewpermnew',
- postperm='$postpermnew', replyperm='$replypermnew', getattachperm='$getattachpermnew' WHERE fid='$fid'");
复制代码
替换为
- $db->query("UPDATE $table_forums SET type='$typenew', status='$statusnew', fup='$fupnew', name='$namenew', name2='$namenew2', icon='$iconnew',
- description='$descriptionnew', description2='$descriptionnew2', styleid='$styleidnew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew',
- allowimgcode='$allowimgcodenew', allowsmilies='$allowsmiliesnew', postcredits='".intval($postcreditsnew)."',
- replycredits='".intval($replycreditsnew)."', password='$passwordnew', viewperm='$viewpermnew',
- postperm='$postpermnew', replyperm='$replypermnew', getattachperm='$getattachpermnew' WHERE fid='$fid'");
复制代码
寻找
- if (strlen($namenew) > 255) cpmsg('forums_forum_name_toolong');
- $db->query("UPDATE $table_forums SET name='$namenew' WHERE fid='$fid'");
- updatecache('forums');
- cpmsg('forums_edit_succeed');
复制代码
替换为
- if (strlen($namenew) > 255) cpmsg('forums_forum_name_toolong');
- $db->query("UPDATE $table_forums SET name='$namenew', name2='$namenew2' WHERE fid='$fid'");
- updatecache('forums');
- cpmsg('forums_edit_succeed');
复制代码
寻找
- $query = $db->query("SELECT fid, name FROM $table_forums WHERE fid<>'$fid' AND type<>'sub' ORDER BY displayorder");
- while($fup = $db->fetch_array($query)) {
- $selected = $fup['fid'] == $forum['fup'] ? "selected="selected"" : NULL;
- $fupselect .= "<option value="$fup[fid]" $selected>$fup[name]</option>\n";
- }
复制代码
替换为
- $query = $db->query("SELECT fid, name, name2 FROM $table_forums WHERE fid<>'$fid' AND type<>'sub' ORDER BY displayorder");
- while($fup = $db->fetch_array($query)) {
- $selected = $fup['fid'] == $forum['fup'] ? "selected="selected"" : NULL;
- $fupselect .= "<option value="$fup[fid]" $selected>$fup[name]/$fup[name2]</option>\n";
- }
复制代码
5. 修改index.php
寻找
- "SELECT fid, fup, type, icon, name, description, moderator, threads, posts, lastpost, viewperm FROM $table_forums WHERE status='1' ORDER BY type, displayorder";
复制代码
替换为
- "SELECT fid, fup, type, icon, name,name2,description,description2,moderator, threads, posts, lastpost, viewperm FROM $table_forums WHERE status='1' ORDER BY type, displayorder";
复制代码
寻找
- SELECT fid, fup, type, icon, name, description, moderator, threads, posts, lastpost, viewperm FROM $table_forums
- WHERE (fid='$gid' OR (fup='$gid' AND type='forum')) AND status='1' ORDER BY type, displayorder";
复制代码
替换为
- SELECT fid, fup, type, icon, name,name2,description,description2, moderator, threads, posts, lastpost, viewperm FROM $table_forums
- WHERE (fid='$gid' OR (fup='$gid' AND type='forum')) AND status='1' ORDER BY type, displayorder";
复制代码
寻找
- $sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.icon, f.name, f.description, f.moderator, f.threads, f.posts, f.lastpost, f.viewperm, a.allowview FROM $table_forums f
- LEFT JOIN $table_access a ON a.uid='$discuz_uid' AND a.fid=f.fid
- WHERE f.status='1' ORDER BY f.type, f.displayorder"
- : "SELECT fid, fup, type, icon, name, description, moderator, threads, posts, lastpost, viewperm FROM $table_forums WHERE status='1' ORDER BY type, displayorder";
复制代码
替换为
- $sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.icon, f.name,f.name2, f.description,f.description2, f.moderator, f.threads, f.posts, f.lastpost, f.viewperm, a.allowview FROM $table_forums f
- LEFT JOIN $table_access a ON a.uid='$discuz_uid' AND a.fid=f.fid
- WHERE f.status='1' ORDER BY f.type, f.displayorder"
- : "SELECT fid, fup, type, icon, name,name2,description,description2,moderator, threads, posts, lastpost, viewperm FROM $table_forums WHERE status='1' ORDER BY type, displayorder";
复制代码
6. 修改admin/settings.php
寻找
- showsetting('settings_bbname', 'settingsnew[bbname]', $settings['bbname'], 'text');
复制代码
下面增加
- showsetting('settings_bbname2', 'settingsnew[bbname2]', $settings['bbname2'], 'text');
复制代码
寻找
- showsetting('settings_sitename', 'settingsnew[sitename]', $settings['sitename'], 'text');
复制代码
下面增加
- showsetting('settings_sitename2', 'settingsnew[sitename2]', $settings['sitename2], 'text');
复制代码
寻找
- $settingsnew['bbname'] = dhtmlspecialchars($settingsnew['bbname']);
复制代码
下面增加
- $settingsnew['bbname2'] = dhtmlspecialchars($settingsnew['bbname2']);
复制代码
7. 修改viewthread.php, forumdisplay.php和index.php
寻找 $navigation 和 $navtitle
增加 $navigation2 和 $navtitle2的定义 (定义方法:寻找$navigation和$navititle, 复制后,在下面添加,然后将其中的name改为name2即可)
8. 修改template/chinese目录下forumdisplay.html, viewthread.html, header.html, index.html,footer.html
寻找 $bbname, $navigation 和 $navtitle
替换为 $bbname2, $navigation2 和 $navtitle2
到此大功完成
[ 本帖最后由 gavinjin 于 2005-9-13 08:54 编辑 ] |