/** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration. */ public function init() { $this->_hjs = Yii::$app->assetManager->getBundle(HighlightAsset::className()); $this->_ace = Yii::$app->assetManager->getBundle(AceEditorAsset::className()); $this->_hjs->css = ['dist/styles/' . $this->highlightStyle . '.css']; parent::init(); }
<?php use yii\helpers\Html; use yii\helpers\Url; use app\modules\blog\models\Tags; use app\modules\blog\models\PostComment; use kartik\markdown\Markdown; use nezhelskoy\highlight\HighlightAsset; use app\modules\blog\Module; HighlightAsset::register($this); /* @var $model app\modules\blog\models\Post */ ?> <h2><?php echo $model->title; ?> </h2> <p> <span class="glyphicon glyphicon glyphicon-user"></span> <?php echo $model->author->profile->name ? $model->author->profile->name . ' ' . $model->author->profile->surname : $model->author->username; ?> | <span class="glyphicon glyphicon-time"></span> <?php echo Yii::$app->formatter->asDate($model->created_at); ?> | <span class="glyphicon glyphicon-th-large"></span> <?php echo $model->category->title; ?>