view.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use slavkovrn\lightbox\LightBoxWidget;
  3. use yii\helpers\Html;
  4. use yii\widgets\DetailView;
  5. /* @var $this yii\web\View */
  6. /* @var $model common\models\Cat */
  7. $this->title = $model->title;
  8. $this->params['breadcrumbs'][] = ['label' => '分类', 'url' => ['index']];
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <div class="cat-view">
  12. <?= $this->render('../site/view_menu', [ 'model' => $model]) ?><div class="box box-success">
  13. <div class="box-body">
  14. <?= DetailView::widget([
  15. 'model' => $model,
  16. 'attributes' => [
  17. 'id',
  18. 'title',
  19. 'ptitle',
  20. [
  21. 'attribute' => 'cover',
  22. 'format' => 'raw',
  23. 'value' => function ($model){
  24. $images = [ // images at popup window of prettyPhoto galary
  25. 1 => [
  26. 'src' => $model->cover,
  27. 'title' => '',
  28. ],
  29. ];
  30. return $model->cover ? LightBoxWidget::widget([
  31. 'id' =>'lightbox', // id of plugin should be unique at page
  32. 'class' =>'galary', // class of plugin to define style
  33. 'height' =>'100px', // height of image visible in widget
  34. 'width' =>'100px', // width of image visible in widget
  35. 'images' => $images,
  36. ]) : null;
  37. }
  38. ],
  39. 'created_at:datetime',
  40. 'updated_at:datetime',
  41. 'slug',
  42. 'sort'
  43. ],
  44. ]) ?>
  45. </div>
  46. </div>
  47. </div>