public function actionIndex() { \Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => 'Cập nhật tin tức khoa học, công nghệ mới nhất, nhanh nhất '], "index"); \Yii::$app->view->registerMetaTag(['name' => 'keywords', 'content' => 'Khoa học, công nghệ, tin tức, khám phá, bí ẩn '], "index"); $news = new News(); /* paging */ $limit = 20; return $this->render('index', ['nnews' => $news->news($limit, $this->paging($limit)), 'news' => $news]); }
use app\helpers\MyDefine; use yii\helpers\Url; $news = new News(); ?> <section id="slider"> <div class="container"> <div class="main-slider"> <div class="badg"> <p><a href="#">News.</a></p> </div> <div class="flexslider"> <ul class="slides"> <?php foreach ($news->news(5, 3) as $item) { ?> <li style="width:540px; height:370px; overflow:hidden;"> <a href="<?php echo Url::to(['site/detail', 'id' => $item->id, 'slug' => $item->slug]); ?> "> <img width="540px" src="<?php echo $item['images']; ?> " alt="MyPassion" /> </a> <p class="flex-caption"><a href="<?php echo Url::to(['site/detail', 'id' => $item->id, 'slug' => $item->slug]); ?> "><?php