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


PHP News::search方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $model = new News('search');
     $model->unsetAttributes();
     if (isset($_GET['News'])) {
         $model->setAttributes($_GET['News']);
     }
     $dataProvider = $model->search();
     $this->render('//news/index', array('dataProvider' => $dataProvider, 'model' => $model));
 }
开发者ID:mmorpg2015,项目名称:ghtweb5,代码行数:10,代码来源:NewsController.php

示例2: actionList

 public function actionList()
 {
     $this->breadcrumbs[] = array('title' => "Новости", 'url' => $this->createUrl("list"));
     $this->Title = "Новости";
     $model = new News("search");
     if (!empty($_GET['filter'])) {
         $model->attributes = $_GET['filter'];
     }
     $dataProvider = $model->search();
     $this->render("list", ["dP" => $dataProvider]);
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:11,代码来源:NewsController.php

示例3: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->pageTitle = Yii::t('titles', 'NEWS_NEWS');
     $model = new News('search');
     $model->unsetAttributes();
     $this->render('index', array('dataProvider' => $model->search()));
 }
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:10,代码来源:NewsController.php

示例4: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = new News('search');
     $model->unsetAttributes();
     $this->render('index', array('dataProvider' => $model->search()));
 }
开发者ID:ASDAFF,项目名称:RosYama.2,代码行数:9,代码来源:NewsController.php

示例5: search

 /**
  * @test
  */
 public function search()
 {
     $model = new News('search');
     $model->unsetAttributes();
     // recherche par date
     $model->unsetAttributes();
     $model->event_date = "01/06/2013";
     $data = $model->search()->data;
     $this->assertEquals(1, count($data));
     $this->assertEquals($this->news('n1')->id, $data[0]->id);
     // recherche par statut
     $model->unsetAttributes();
     $model->enabled = 0;
     $data = $model->search()->data;
     $this->assertEquals(1, count($data));
     // recherche par catégorie
     $model->unsetAttributes();
     $categoryId = 1;
     // la plupart des news sont de cette catégorie
     $model->category_id = $categoryId;
     $count = Yii::app()->db->createCommand("SELECT count(*) as cpt FROM news WHERE category_id = {$categoryId}")->queryScalar();
     $this->assertEquals($count, count($model->search()->data));
     $model->unsetAttributes();
     $categoryId = 2;
     // il y a quelques news de cette catégorie
     $model->category_id = $categoryId;
     $count = Yii::app()->db->createCommand("SELECT count(*) as cpt FROM news WHERE category_id = {$categoryId}")->queryScalar();
     $this->assertEquals($count, count($model->search()->data));
     $model->unsetAttributes();
     $categoryId = 99;
     // aucune news de cette catégorie
     $model->category_id = $categoryId;
     $count = Yii::app()->db->createCommand("SELECT count(*) as cpt FROM news WHERE category_id = {$categoryId}")->queryScalar();
     $this->assertEquals($count, count($model->search()->data));
 }
开发者ID:ChristopheBrun,项目名称:hLib,代码行数:38,代码来源:NewsTest.php


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