Example #1
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\AdsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '广告管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ads-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('添加广告', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'place', 'value' => function ($model) {
    return common\models\Ads::getPlace($model->place);
}], 'thumb', 'title', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Example #2
0
    ?>
</a></li>
                    <?php 
}
?>
                    
                </ul>
            </div>
            <!--学霸必备结束-->
        </div>
        <div class="cl"></div>
   </div>
   <!--底部广告开始-->
   <div  class="db-ad margin-bottom33">
       <?php 
$ads = common\models\Ads::find()->where(['place' => 1])->one();
if ($ads) {
    if ($ads->url) {
        echo '<a href="' . $ads->url . '" target="_blank"><img src="' . $ads->thumb . '" width="1190" height="80" /></a>';
    } else {
        echo '<img src="' . $ads->thumb . '" width="1190" height="80" />';
    }
}
?>
   </div>
   <!--底部广告结束-->
   <!--友情链接开始-->
   <div class="friendship">
   		<div class="friendship-tit">友情链接</div>
        <ul class="friendship-nr">
            <?php