2011-2-21 by qidizi增加功能:分类中增加一个属性,用于控制是否在前台主页分类中显示此分类;1 ask_category表中增加一个字段:index_show boolean 默认是0;alter table ask_category add `index_show` boolean not null default 0;2 修改view目录中editcategory.html文件加上开关 在分类目录后插入以下代码
<tr><th colspan="2">首页显示:</th></tr><tr><td><input name="index_show" type="checkbox" {eval echo ($category['index_show']?"checked":''); }></td><td>在首页左边的分类中是否显示。</td></tr>3 修改control文件夹中admin_category.php加上传入参数代码
在onedit()中 $index_show = $this->post['index_show']; if (isset($index_show) && ($index_show == 'on'))$index_show=1; else $index_show = 0;前插入上面代码,并为下面增加参数$index_show, $_ENV['category']->update_by_id($id,$name,$categorydir,$cid,$index_show);4 model文件夹中category.class.php增加接收参数 function update_by_id($id,$name,$categorydir,$pid,$index_show) {增加一参数,$index_show;
5 model中category.class.php修改/*用于在首页左侧显示*/ function list_by_grade($grade=1) {成判断是否属于首页显示的分类再加入首页调用的数组;$query=$this->db->query("select id,name,questions,grade,index_show from ".DB_TABLEPRE."category where grade=1 order by displayorder asc,id asc");加入查询index_show的字段;while($category1=$this->db->fetch_array($query)) { if (!$category1['index_show']) continue;//不属于首页分类不加入数组;加入只有首页显示的分类才显示;修改完成;
