123456789101112131415161718192021 |
- <?php
- namespace app\controllers;
- use yii\web\Controller;
- class ArticlesController extends Controller
- {
- public function actionIndex(){
- $url = \Yii::$app->request->pathInfo;
- if( $url == 'articles/' || $url == 'article/' || $url == 'article' ){
- $queryString = \Yii::$app->request->queryString?'?'.\Yii::$app->request->queryString:'';
- $this->redirect('/articles'.$queryString, 301);
- return '';
- }
- $news_query = \app\models\front\News::find()->joinWith('topics t')
- ->groupBy('news.id')
- ->andFilterWhere(['news.type'=>6]);
- return $this->render("index",["news_query"=>$news_query]);
- }
- }
|