本文整理匯總了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