本文整理汇总了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));
}
示例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));
}
示例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);
}
}