當前位置: 首頁>>代碼示例>>PHP>>正文


PHP article::model方法代碼示例

本文整理匯總了PHP中article::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP article::model方法的具體用法?PHP article::model怎麽用?PHP article::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在article的用法示例。


在下文中一共展示了article::model方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionSystemmain

 /**
  * 後台主頁信息
  */
 public function actionSystemmain()
 {
     $SYS = array('PHP版本:' => $_SERVER['SERVER_SOFTWARE'], '當前係統類型:' => php_uname('s'), 'PHP運行方式:' => php_sapi_name(), '服務器域名:' => $_SERVER['SERVER_NAME'], '服務器端口:' => $_SERVER['SERVER_PORT'], '北京時間:' => date('Y年m月d日 H:i:s', time()));
     $count = array('會員總數:' => Account::model()->count('id!=:ID', array(':ID' => 0)), '文章總數:' => article::model()->count('id!=:ID', array(':ID' => 0)), '評論總數:' => Comments::model()->count('id!=:ID', array(':ID' => 0)));
     $Role = Role::model()->find('id=:ID', array(':ID' => Yii::app()->session['USER_ACCOUNT']['roleId']));
     $basic = array('權限級別:' => $Role->name);
     $this->render('Systemmain', array('SYS' => $SYS, 'Info' => $count, 'basic' => $basic));
 }
開發者ID:xuyi5918,項目名稱:ipensoft,代碼行數:11,代碼來源:SystemController.php

示例2: actionDoclist

 /**
  *  獲取文章列表
  */
 public function actionDoclist()
 {
     $Rolelist = article::model();
     $cri = new CDbCriteria();
     $total = $Rolelist->count($cri);
     $pager = new CPagination($total);
     $pager->pageSize = 10;
     $pager->applyLimit($cri);
     $Infolist = $Rolelist->findAll($cri);
     $this->render('doc_list', array('taglist' => $Infolist, 'Pagers' => $pager));
 }
開發者ID:xuyi5918,項目名稱:ipensoft,代碼行數:14,代碼來源:MainController.php

示例3: actionTags

 /**
  * 查詢出該標簽下有多少篇文章
  * @param int $tagId 需要查詢的tag標簽id
  */
 public function actionTags($tagId = 0)
 {
     if (!isset($_GET['parent'])) {
         $_GET['parent'] = 100;
         $this->Menu = $this->Menulist('> 0', 100);
     } else {
         $this->Menu = $this->Menulist('> 0', $_GET['parent']);
     }
     $Md5cacheKey = md5('Category' . $tagId . $_GET['parent'] . $tagId);
     if (!empty($tagId)) {
         $Sql = "SELECT tagsAs.articleId FROM `" . $this->table('tagsasarticle') . "` AS tagsAs left join tags on tags.id=tagsAs.tagsId Where tags.name = '" . $tagId . "' Group by tagsAs.`articleId`";
         if (!($cache = $this->cached($Md5cacheKey))) {
             $articleId = CActiveRecord::$db->createCommand($Sql)->queryAll();
             $this->cached($Md5cacheKey, $articleId);
         } else {
             $articleId = $this->cached($Md5cacheKey);
         }
         $aid = array();
         foreach ($articleId as $key => $value) {
             array_push($aid, $value['articleId']);
         }
         $cri = new CDbCriteria();
         $cri->order = 'id desc';
         $cri->addInCondition('id', $aid);
         $count = article::model()->count($cri);
         $pager = new CPagination($count);
         $pager->pageSize = 15;
         $pager->applyLimit($cri);
         $AllTag = article::model()->findAll($cri);
         $webdata = array('list' => $AllTag, 'Pages' => $pager);
         $this->render('list', $webdata);
     }
 }
開發者ID:xuyi5918,項目名稱:ipensoft,代碼行數:37,代碼來源:DefaultController.php


注:本文中的article::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。