}
/* 入库的操作 */
if ($db->autoExecute($ecs->table('category'), $cat) !== false)
{
$cat_id = $db->insert_id();
if($cat['show_in_nav'] == 1)
{
$vieworder = $db->getOne("SELECT max(vieworder) FROM ". $ecs->table('nav') . " WHERE type = 'middle'");
$vieworder += 2;
//显示在自定义导航栏中
$sql = "INSERT INTO " . $ecs->table('nav') .
" (name,ctype,cid,ifshow,vieworder,opennew,url,type)".
" VALUES('" . $cat['cat_name'] . "', 'c', '".$db->insert_id()."','1','$vieworder','0', '" . build_uri('category', array('cid'=> $cat_id), $cat['cat_name']) . "','middle')";
$db->query($sql);
}
insert_cat_recommend($cat['cat_recommend'], $cat_id);
}
}
admin_log($_POST['cat_name'], 'add', 'category'); // 记录管理员操作
clear_cache_files(); // 清除缓存
/*添加链接*/
$link[0]['text'] = $_LANG['continue_add'];
$link[0]['href'] = 'category.php?act=add';
$link[1]['text'] = $_LANG['back_list'];
$link[1]['href'] = 'category.php?act=list';
sys_msg($_LANG['catadd_succed'], 0, $link);
}
三、编辑/languages/zh_cn/admin/category.php,添加
$_LANG['notice_cat_name'] = '如果您需要添加多个分类,请在分类之间使用半角逗号分隔。';
|
$_LANG['notice_cat_name'] = '如果您需要添加多个分类,请在分类之间使用半角逗号分隔。';