kokjan/frontend/views/post/view.php

85 lines
2.6 KiB
PHP
Raw Normal View History

2026-02-25 06:59:34 +00:00
<?php
/* @var $this yii\web\View */
use dosamigos\gallery\Gallery;
use yii\helpers\HtmlPurifier;
use yii\helpers\Html;
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => $model->cmsCategory->name, 'url' => ['index', 'id' => $model->cms_category_id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
/* ควบคุมรูปภาพในเนื้อหา */
.post-content img {
max-width: 100%;
height: auto !important;
}
.gallery-content img {
max-width: 100%;
height: 200px;
}
/* สไตล์สำหรับ ul ภายใน content-image */
#post-container .post-content ul {
/* บังคับให้แสดงจุด */
padding-left: 20px !important;
margin: 0 !important;
}
#post-container .post-content li {
margin-bottom: 5px !important;
list-style: disc !important;
}
</style>
<div class="content-image">
<?php //= Html::img(Yii::$app->abt->getFirstImage($model->description), ['class' => 'img-fluid'])
?>
</div>
<div class="post-summary">
<span class="fa fa-calendar"></span> <?= Yii::$app->formatter->asDatetime($model->publish_at) ?>
<span class="fa fa-folder-open"></span> <?= Html::a($model->cmsCategory->name, ['/post/index', 'id' => $model->cms_category_id]) ?>
<span class="fa fa-user"></span> <?= Html::a($model->createdBy->name, ['/post/author', 'id' => $model->created_by]) ?>
<span class="fa fa-eye"></span> <?= number_format($model->hit) ?>
<?php if (!empty($model->tags)) { ?>
<span class="fa fa-tags"></span> <?= $model->tags ?>
<?php } ?>
</div>
<?php //= HtmlPurifier::process($model->description)
?>
<div id="post-container">
<div class="post-content">
<?= $model->description ?>
<br>
<?= $model->getFileFrontViewer() ?>
<br>
</div>
</div>
<br>
<?php if (!empty($model->gallery)) { ?>
<?php
$photos = explode(',', $model->gallery);
$items = [];
foreach ($photos as $photo) {
$items[] = [
'url' => $model->getGalleryUrl() . '/' . $photo,
'src' => $model->getGalleryUrl() . '/' . $photo,
];
}
?>
<br>
<div class="gallery-content">
<?= Gallery::widget([
'items' => $items,
]);
?>
</div>
<?php } ?>
<script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=6392a5ec44c4120012bde3f8&product=inline-share-buttons&source=platform" async="async"></script>
<br>
<div class="sharethis-inline-share-buttons"></div>
<br>