Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Menu::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'pid' => $this->pid, 'sort' => $this->sort, 'hide' => $this->hide, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'tip', $this->tip])->andFilterWhere(['like', 'group', $this->group]);
     return $dataProvider;
 }
Beispiel #2
0
  <body>
  <?php 
echo $this->beginBody();
?>

    <div class="blog-masthead">
      <div class="container">
        <nav class="blog-nav">
         <!--  <a class="blog-nav-item active" href="#">Home</a>
          <a class="blog-nav-item" href="#">New features</a>
          <a class="blog-nav-item" href="#">Press</a>
          <a class="blog-nav-item" href="#">New hires</a>
          <a class="blog-nav-item" href="#">About</a> -->
          <?php 
$menus = \frontend\models\Menu::find()->orderBy('_order')->all();
foreach ($menus as $k => $v) {
    ?>
            <a class="blog-nav-item" href="<?php 
    echo $v['url'];
    ?>
"><?php 
    echo $v['title'];
    ?>
</a>
          <?php 
}
?>
        </nav>
      </div>
    </div>