public function init() { parent::init(); $session = \Yii::$app->session; $flashes = $session->getAllFlashes(); $view = $this->getView(); AssetBundle::register($view); foreach ($flashes as $key => $value) { \Yii::$app->view->registerJs(' $.iGrowl({ type: "' . $key . '", message: "' . $value . '", offset : { y: 60 } }); '); $session->removeFlash($key); } }
<?php use yii\helpers\Html; use yii\widgets\ListView; use common\widgets\iGrowl\AssetBundle; use common\widgets\MasonryInfiniteScroll\InfiniteScrollPager; use yii\widgets\Pjax; use yii\helpers\Url; AssetBundle::register($this); /* @var $this yii\web\View */ /* @var $searchModel common\models\AdMainSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->params['breadcrumbs'][] = $this->title; ?> <div class="container" > <?php if (Yii::$app->controller->action->id == 'my') { $this->title = Yii::t('app', 'My ads'); } elseif (Yii::$app->controller->action->id == 'favorites') { $this->title = Yii::t('app', 'Selected ads'); } elseif (Yii::$app->controller->action->id == 'one') { $this->title = Yii::t('app', 'Related ads'); } else { $this->title = Yii::t('app', 'List of ads') . ': ' . Yii::$app->placeManager->getCityName(); } ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php