当前位置: 首页>>代码示例>>PHP>>正文


PHP Column::getOne方法代码示例

本文整理汇总了PHP中Column::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getOne方法的具体用法?PHP Column::getOne怎么用?PHP Column::getOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Column的用法示例。


在下文中一共展示了Column::getOne方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionShow

 /**
  * 按地区显示的主页
  */
 public function actionShow()
 {
     $areaid = zmf::filterInput($_GET['areaid']);
     $where = $order = $areaInfo = '';
     if ($areaid) {
         $extra = Area::getAreaInfo($areaid);
         $areaIds = $extra['areaIds'];
         $areaInfo = $extra['areaInfo'];
         if ($areaIds) {
             $where .= " areaid IN({$areaIds}) AND ";
         }
     }
     //获取热门游记
     $_postsql = "SELECT * FROM {{posts}} WHERE {$where} classify='" . Posts::CLASSIFY_TRAVEL_LOG . "' AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 8";
     $posts = Yii::app()->db->createCommand($_postsql)->queryAll();
     if (!empty($posts)) {
         foreach ($posts as $k => $p) {
             $posts[$k]['coltitle'] = '';
             if ($p['colid']) {
                 $coltitle = Column::getOne($p['colid'], 'title');
                 if ($coltitle) {
                     $posts[$k]['coltitle'] = $coltitle;
                 }
             }
         }
     }
     //获取图片
     //        $_attsql = "SELECT * FROM {{attachments}} WHERE areaid IN(" . $this->areaIds . ") AND classify='poi' AND status=" . Posts::STATUS_PASSED . " ORDER BY  cTime DESC LIMIT 8";
     //        $attaches = Yii::app()->db->createCommand($_attsql)->queryAll();
     //获取点评
     //        $_postsql = "SELECT * FROM {{poi_post}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5";
     //        $poiposts = Yii::app()->db->createCommand($_postsql)->queryAll();
     //        foreach ($poiposts as $k => $poipost) {
     //            $_info = Posts::getSimpleInfo(array('keyid' => $poipost['logid'], 'origin' => 'position'), 'title');
     //            $poiposts[$k]['poiTitle'] = $_info;
     //        }
     //将问题和回答混合到动态里
     //        $_qasql = "SELECT * FROM ((SELECT 'question' AS type,id,uid,'logid',title,content,cTime,answers,comments,favorite AS favor,'nouse' FROM {{question}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5) UNION (SELECT 'answer' AS type,id,uid,logid,'title',content,cTime,'answers',comments,favor,nouse FROM {{answer}} WHERE areaid IN(" . $this->areaIds . ") AND status=" . Posts::STATUS_PASSED . " ORDER BY cTime DESC LIMIT 5)) as t ORDER BY t.cTime DESC";
     //        $questions = Yii::app()->db->createCommand($_qasql)->queryAll();
     //        foreach ($questions as $k => $v) {
     //            if ($v['type'] == 'answer') {
     //                $_info = Posts::getSimpleInfo(array('keyid' => $v['logid'], 'origin' => 'question'), 'title');
     //                $questions[$k]['qtitle'] = $_info;
     //            }
     //        }
     //热门坐标
     $_poisql = "SELECT id,title_cn,title_en,title_local,address_cn,address_en,address_local,score,scorer,attach,lat,`long`,faceimg,classify FROM {{position}} WHERE {$where} status=" . Posts::STATUS_PASSED . " ORDER BY scorer DESC LIMIT 5";
     $positions = Yii::app()->db->createCommand($_poisql)->queryAll();
     //获取小提示
     //        $_poi_tips_sql = "SELECT 'PoiTips' AS type,id,uid,content,'score','cost',favor,comments,cTime,platform FROM {{poi_tips}} WHERE logid={$this->theAreaId} AND classify=" . Position::AREA . " AND status=" . Posts::STATUS_PASSED . " ORDER BY favor LIMIT 10";
     //        $poitips = Yii::app()->db->createCommand($_poi_tips_sql)->queryAll();
     //        //获取所有受推荐地区
     $areas = Area::getTops(0);
     //面包屑
     $breads[] = CHtml::link('目的地', array('position/index'));
     //页面SEO
     //        $this->pageTitle = $this->areaInfo['title'] . '攻略,' . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '行程推荐,' . $this->areaInfo['title'] . '问答 - ' . zmf::config('sitename');
     //        $this->keywords = zmf::time('', 'Y年') . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '行程推荐,' . $this->areaInfo['title'] . '问答,' . $this->areaInfo['title'] . '景点';
     //        $this->pageDescription = '【' . $this->areaInfo['title'] . '】' . $this->areaInfo['title'] . '游记,' . $this->areaInfo['title'] . '照片,' . $this->areaInfo['title'] . '热门景点、酒店、餐厅、购物以及与' . $this->areaInfo['title'] . '有关的问与答';
     $data = array('areaInfo' => $areaInfo, 'areaid' => $areaid, 'posts' => $posts, 'areas' => $areas, 'breads' => $breads, 'attaches' => $attaches, 'poiposts' => $poiposts, 'questions' => $questions, 'positions' => $positions, 'poitips' => $poitips, 'weather' => $weather);
     $this->render('show', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:65,代码来源:IndexController.php

示例2: actionIndex

 public function actionIndex()
 {
     $this->pType = zmf::filterInput($_GET['type']);
     $this->pOrder = zmf::filterInput($_GET['order']);
     $areaid = zmf::filterInput($_GET['areaid']);
     $colid = zmf::filterInput($_GET['colid']);
     $tagid = zmf::filterInput($_GET['tagid']);
     if (!$this->pOrder || !in_array($this->pOrder, array('1', '2'))) {
         $this->pOrder = '1';
     }
     $where = $order = $areaInfo = '';
     if ($areaid) {
         $extra = Area::getAreaInfo($areaid);
         $areaIds = $extra['areaIds'];
         $areaInfo = $extra['areaInfo'];
         if ($areaIds) {
             $where .= " p.areaid IN({$areaIds}) AND ";
         }
     }
     if ($colid) {
         $where .= " p.colid='{$colid}' AND ";
         $this->selectColid = $colid;
     }
     if ($this->pOrder == '1') {
         $order = ' ORDER BY p.cTime DESC';
     } elseif ($this->pOrder == '2') {
         $order = ' ORDER BY p.hits DESC';
     }
     if ($tagid) {
         $sql = "SELECT p.id,p.title,p.faceimg,p.uid,p.colid,p.cTime,p.updateTime FROM {{posts}} p,{{tag_relation}} tr WHERE tr.tagid='{$tagid}' AND tr.classify='posts' AND tr.logid=p.id AND {$where} p.classify=" . Posts::CLASSIFY_WEDDING . " AND p.status=" . Posts::STATUS_PASSED . $order;
     } else {
         $sql = "SELECT p.id,p.title,p.faceimg,p.uid,p.colid,p.cTime,p.updateTime FROM {{posts}} p WHERE {$where} p.classify=" . Posts::CLASSIFY_WEDDING . " AND p.status=" . Posts::STATUS_PASSED . $order;
     }
     Posts::getAll(array('sql' => $sql), $pages, $posts);
     if (!empty($posts)) {
         foreach ($posts as $k => $p) {
             $posts[$k]['coltitle'] = '';
             if ($p['colid']) {
                 $coltitle = Column::getOne($p['colid'], 'title');
                 if ($coltitle) {
                     $posts[$k]['coltitle'] = $coltitle;
                 }
             }
             if ($p['faceimg'] > 0) {
                 $_attach = Attachments::getOne($p['faceimg']);
                 $_url = Attachments::getUrl($_attach);
                 $posts[$k]['faceimg'] = $_url;
             } else {
                 $posts[$k]['faceimg'] = '';
             }
         }
     }
     //面包屑
     $breads[] = CHtml::link('作品集', array('posts/index'));
     if ($areaInfo) {
         $breads[] = $areaInfo['title'];
     }
     //获取所有受推荐地区
     $areas = Area::getTops(0);
     //文章分类
     $cols = Column::allCols(1, 0, 1, Posts::CLASSIFY_WEDDING);
     //推荐的标签
     $suggestTags = Tags::getTops('posts');
     $data = array('posts' => $posts, 'pages' => $pages, 'breads' => $breads, 'areas' => $areas, 'areaId' => $areaid, 'cols' => $cols, 'tags' => $suggestTags, 'tagid' => $tagid);
     $this->pageTitle = '作品集 - ' . zmf::config('sitename');
     $this->render('all', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:67,代码来源:PostsController.php


注:本文中的Column::getOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。