Пример #1
0
<?php

/* @var $this yii\web\View */
/* @var $model app\models\Page */
use yii\helpers\Html;
use app\models\Image;
?>

<h2><?php 
echo $model->title;
?>
</h2>
<h2><?php 
echo $model->text;
?>
</h2>
<h2><?php 
echo Html::img(Image::getImagePath($model->getImage()->one()));
?>
</h2>
Пример #2
0
use yii\helpers\Html;
use yii\widgets\DetailView;
use app\models\Image;
/* @var $this yii\web\View */
/* @var $model app\models\Page */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="page-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'title', 'text:ntext', 'lang', ['attribute' => 'image_id', 'value' => Image::getImagePath($model->getImage()->one()), 'format' => ['image', ['width' => '100', 'height' => '100']]]]]);
?>

</div>