求助:文章修改时候如何获取文章属性是否为选中状态

浏览:569 发布日期:2014/07/04 分类:求助交流
页面效果

问题:修改文章时候有一个文章属性,如何判断是否为选中状态呢,表结构
news 表是文章表
attr 表是文章属性表
news_attr 表是中间表关联他俩

以下是我的修改代码,实在是不知道怎么写了,求指教    //修改新闻
    public function update(){
        $id=(int)$_GET['id'];

        //实例化第三方类
        $Category = new \Org\Util\Category;
        $cate=M("cate")->order('sort ASC')->select();
        //传递到第三方类进行处理
        $cate=$Category::unlimitedForLevel($cate,'  --');
        $this -> cate = $cate;

        //属性
        $attr = M("attr")->select();
        $this -> attr = $attr;
        dump($attr);
        
        //文章属性
        $news_attr = M('news_attr')->where(array('news_id'=>$id))->select();
        $this->news_attr = $news_attr;
        //dump($news_attr);

        //文章内容
        $news=M('News')->where(array('id'=>$id))->find();
        $this->assign('news',$news);
        $this -> display();
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>