本文整理汇总了PHP中app\models\News::news方法的典型用法代码示例。如果您正苦于以下问题:PHP News::news方法的具体用法?PHP News::news怎么用?PHP News::news使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\News
的用法示例。
在下文中一共展示了News::news方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
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]);
}
示例2: 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