示例#1
0
 public function del()
 {
     $id = I('id', NULL);
     if (!empty($id)) {
         $article = new GonggaoModel();
         if (is_array($id)) {
             $where = 'id in (' . implode(',', $id) . ')';
         } else {
             $where = 'id = ' . $id;
         }
         if (false !== $article->where($where)->delete()) {
             $this->message('删除成功', __URL__ . '/index');
         } else {
             $this->message('删除失败:' . $article->getError(), __URL__ . '/index');
         }
     } else {
         $this->message('请选择删除对象', __URL__ . '/index');
     }
 }
示例#2
0
 public function gonggao()
 {
     $id = I('id', NULL);
     if (empty($id)) {
         $this->message2('未指定公告!', 'index');
     }
     $model = new GonggaoModel();
     $gonggao = $model->where('id=' . $id)->find();
     if ($gonggao['keyword'] != '') {
         $this->assign('seo_keyword', $gonggao['keyword']);
     }
     if ($gonggao['desc'] != '') {
         $this->assign('seo_desc', $gonggao['desc']);
     }
     $config = M('config')->where('id=1')->find();
     $this->assign('seo_title', $gonggao['title'] . '-' . $config['sitename']);
     $this->assign('gonggao', $gonggao);
     $this->display();
 }