本文整理汇总了PHP中zmf::val方法的典型用法代码示例。如果您正苦于以下问题:PHP zmf::val方法的具体用法?PHP zmf::val怎么用?PHP zmf::val使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zmf
的用法示例。
在下文中一共展示了zmf::val方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionView
public function actionView()
{
$id = zmf::val('id', 2);
if (!$id) {
throw new CHttpException(404, 'The requested page does not exist.');
}
$info = $this->loadModel($id);
$pageSize = 30;
$comments = Comments::getCommentsByPage($id, 'posts', 1, $pageSize);
$tags = Tags::getByIds($info['tagids']);
$relatePosts = Posts::getRelations($id, 5);
if (!zmf::actionLimit('visit-Posts', $id, 5, 60)) {
Posts::updateCount($id, 'Posts', 1, 'hits');
}
$size = '600';
if ($this->isMobile) {
$size = '640';
}
$info['content'] = zmf::text(array(), $info['content'], true, $size);
$data = array('info' => $info, 'comments' => $comments, 'tags' => $tags, 'relatePosts' => $relatePosts, 'loadMore' => count($comments) == $pageSize ? 1 : 0);
$this->favorited = Favorites::checkFavored($id, 'post');
$this->pageTitle = $info['title'];
$this->selectNav = 'posts';
$this->render('view', $data);
}
示例2: actionIndex
public function actionIndex()
{
$tagid = zmf::val('tagid', 2);
$tagInfo = array();
$default = true;
if ($tagid) {
$tagInfo = Tags::getByIds($tagid);
if ($tagInfo) {
$default = false;
$tagInfo = $tagInfo[0];
$sql = "SELECT p.id,p.uid,p.title,p.faceimg,p.content,p.tagids,p.comments,p.favorite FROM {{posts}} p,{{tag_relation}} tr WHERE tr.tagid='{$tagid}' AND tr.classify='posts' AND tr.logid=p.id AND p.`status`=" . Posts::STATUS_PASSED . " ORDER BY p.cTime DESC";
}
}
if ($default) {
$sql = 'SELECT id,uid,title,faceimg,content,tagids,comments,favorite FROM {{posts}} WHERE `status`=1 ORDER BY cTime DESC';
}
Posts::getAll(array('sql' => $sql), $pages, $posts);
$size = '640';
if ($this->isMobile) {
$size = '240';
}
foreach ($posts as $k => $val) {
if ($val['tagids'] != '') {
$_tags = Tags::getByIds($val['tagids']);
$posts[$k]['tagids'] = $_tags;
}
$posts[$k]['faceimg'] = Attachments::faceImg($val, $size);
}
$this->pageTitle = '文章 - ' . zmf::config('sitename');
$this->selectNav = 'posts';
$data = array('posts' => $posts, 'tagInfo' => $tagInfo, 'pages' => $pages);
$this->render('/index/index', $data);
}
示例3: actionIndex
public function actionIndex()
{
$type = zmf::val('type', 1);
if (!$type || $type == 'staycheck') {
$status = Posts::STATUS_STAYCHECK;
} else {
$status = Posts::STATUS_PASSED;
}
$sql = "SELECT c.id,c.uid,c.content,c.cTime,p.title,c.logid,c.status FROM {{comments}} c,{{posts}} p WHERE c.status={$status} AND c.logid=p.id ORDER BY c.cTime DESC";
Posts::getAll(array('sql' => $sql), $pager, $items);
if (!empty($items)) {
$uids = array_filter(array_keys(CHtml::listData($items, 'uid', '')));
$uidsStr = join(',', $uids);
if ($uidsStr != '') {
$usernames = Yii::app()->db->createCommand("SELECT id,truename FROM {{users}} WHERE id IN({$uidsStr})")->queryAll();
if (!empty($usernames)) {
foreach ($items as $k => $val) {
foreach ($usernames as $val2) {
if ($val['uid'] > 0 && $val['uid'] == $val2['id']) {
$items[$k]['loginUsername'] = $val2['truename'];
}
}
}
}
}
}
$this->render('index', array('pages' => $pager, 'posts' => $items));
}
示例4: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
$criteria = new CDbCriteria();
$uid = zmf::val('uid', 2);
if ($uid) {
$criteria->addCondition("uid='{$uid}'");
}
$criteria->order = '`status` ASC,cTime DESC';
$count = Feedback::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 30;
$pager->applyLimit($criteria);
$posts = Feedback::model()->findAll($criteria);
$this->render('index', array('pages' => $pager, 'posts' => $posts));
}
示例5: actionIndex
public function actionIndex()
{
$uid = zmf::val('uid', 2);
$username = zmf::val('username', 1);
$start = zmf::val('start', 1);
$end = zmf::val('end', 1);
$orderBy = zmf::val('orderBy', 1);
$criteria = new CDbCriteria();
$criteria->addInCondition('status', array(Posts::STATUS_NOTPASSED, Posts::STATUS_PASSED));
if ($username) {
$uinfo = Users::model()->find("username LIKE '%{$username}%'");
if ($uinfo) {
$uid = $uinfo['id'];
}
}
if ($uid) {
$criteria->addCondition("uid='{$uid}'");
}
if ($start) {
$start = strtotime($start, $now);
$criteria->addCondition("cTime>='{$start}'");
}
if ($end) {
$end = strtotime($end, $now);
$criteria->addCondition("cTime<='{$end}'");
}
if ($orderBy == 'hits') {
$criteria->order = 'hits DESC';
} elseif ($orderBy == 'favors') {
$criteria->order = 'favors DESC';
} elseif ($orderBy == 'imgs') {
$criteria->order = 'imgs DESC';
} elseif ($orderBy == 'videos') {
$criteria->order = 'videos DESC';
} else {
$criteria->order = 'cTime DESC';
}
$count = Posts::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 30;
$pager->applyLimit($criteria);
$posts = Posts::model()->findAll($criteria);
$this->render('index', array('pages' => $pager, 'posts' => $posts));
}
示例6: actionInfo
public function actionInfo()
{
$code = zmf::val('code', 1);
$_title = SiteInfo::exTypes($code);
if (!$_title) {
throw new CHttpException(404, '您所查看的页面不存在');
}
$info = SiteInfo::model()->find('code=:code', array(':code' => $code));
if (!$info) {
throw new CHttpException(404, '您所查看的页面不存在');
}
$allInfos = SiteInfo::model()->findAll(array('select' => 'code,title', 'condition' => 'code!=:code AND status=' . Posts::STATUS_PASSED, 'params' => array(':code' => $code)));
//更新访问统计
Posts::updateCount($info['id'], 'SiteInfo');
$data = array('info' => $info, 'code' => $code, 'allInfos' => $allInfos);
$this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename');
$this->selectNav = 'about';
$this->render('about', $data);
}
示例7: actionFavorite
public function actionFavorite()
{
$data = zmf::val('data', 1);
$type = zmf::val('type', 1);
$ckinfo = Posts::favorite($data, $type, 'web');
$this->jsonOutPut($ckinfo['state'], $ckinfo['msg']);
}