Example #1
0
 /**
  * 修改文章页面
  */
 public function showModify()
 {
     $id = I('get.id');
     $blog = M('blog')->where('id=' . $id)->select();
     // 所有分类
     $cate = M('cate')->order('sort')->select();
     $cate = \Admin\Common\Category::unlimitedForLevel($cate);
     // 所有属性
     $attr = M('attr')->select();
     // 将时间戳转换为易读的时间
     $blog[0]['time'] = date('Y-m-d H:i:s', $blog[0]['time']);
     // 将本文属性加入到数组中
     $blog[0]['attr'] = M('blog_attr')->where('bid=' . $id)->field('aid')->select();
     $blog[0]['attr'] = \myFunction\multiArray_combine($blog[0]['attr']);
     $this->assign("cate", $cate);
     $this->assign("attr", $attr);
     $this->assign("modify", $blog[0]);
     $this->display("Blog:blog");
 }
 public function index()
 {
     $cate = M('cate')->order('sort DESC')->select();
     $this->cate = \Admin\Common\Category::unlimitedForLevel($cate, '  --');
     $this->display();
 }