Exemple #1
0
 function findArticles($select = null)
 {
     $t = new Articles();
     if (is_string($select)) {
         $select = $t->select()->where($select);
     }
     $select->setIntegrityCheck(false)->from('article')->where('article.journal = ?', $this->id);
     return $t->fetchAll($select);
 }
 /**
  * 添加、修改文章
  */
 public function actionModify($id)
 {
     $id = (int) $id;
     $where = array('a.aid' => $id);
     $Articles = new Articles();
     $Category = new Category();
     $this->data = $Articles->select('c.*,a.*')->from('articles a')->join('articles_content c', 'a.aid=c.aid')->where($where)->getOne();
     $this->data['content'] = stripslashes($this->data['content']);
     $this->category = $Category->getAll();
 }
 /**
  * 文章详情
  */
 public function actionArticle($aid)
 {
     $aid = (int) $aid;
     $Articles = new Articles();
     $Category = new Category();
     $where = array('a.aid' => $aid);
     $this->data = $Articles->select('c.*,a.*')->from('articles a')->join('articles_content c', 'a.aid=c.aid')->where($where)->getOne();
     $this->data['content'] = stripslashes($this->data['content']);
     $this->title = $this->data['title'];
     $this->category = $Category->getOne('*', array('cid' => $this->data['cid']));
     $this->cid = $this->data['cid'];
 }
Exemple #4
0
 function findArticles()
 {
     $t = new Articles();
     $s = $t->select()->setIntegrityCheck(false)->distinct()->from('article')->join('commentaire', 'commentaire.id = article.commentaires', array())->where('commentaire.auteur = ?', intval($this->id));
     return $t->fetchAll($s);
 }
Exemple #5
0
 /**
  * 默认函数
  */
 public function actionIndex()
 {
     $Articles = new Articles();
     $this->list = $Articles->select('a.aid,a.title,a.add_date,c.c_name')->from('articles a')->join('category c', 'a.cid=c.cid')->limit(0, 12)->order('a.aid', 'desc')->getAll();
 }