Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ads::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'place' => $this->place, 'ord' => $this->ord, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at]);
     $query->andFilterWhere(['like', 'thumb', $this->thumb])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'url', $this->url]);
     return $dataProvider;
 }
Example #2
0
        <?php 
foreach ($friendlink as $k => $v) {
    ?>
        <a href="<?php 
    echo $v->link;
    ?>
" target="_blank"><span>建材网</span></a>
        <?php 
}
?>
     
    </div>
    </div>
    <div class="ad01">
        <?php 
$ads = \common\models\Ads::find()->where(['id' => 2])->one();
if ($ads) {
    ?>
        <a href="<?php 
    echo $ads->url;
    ?>
" target="_blank"><img src="<?php 
    echo $ads->thumb;
    ?>
" width="1170" height="69" alt=""></a>
            <?php 
}
?>
    </div>
</div>
<?php