chapter.php 1.0 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: NODELOG
  5. * Date: 2016/12/15
  6. * Time: 下午2:20
  7. */
  8. /**
  9. * @var \yii\web\View $this
  10. * @var \common\modules\book\models\BookChapter $model
  11. */
  12. use yii\helpers\Html;
  13. use yii\helpers\HtmlPurifier;
  14. use yii\helpers\Markdown;
  15. $this->title = $model->chapter_name;
  16. $this->params['breadcrumbs'][] = ['label' => 'wiki', 'url' => ['/book/default/index']];
  17. $this->params['breadcrumbs'][] = ['label' => $model->book->book_name, 'url' => ['/book/default/view', 'id' => $model->book->id]];
  18. $this->params['breadcrumbs'][] = Html::encode($model->chapter_name);
  19. ?>
  20. <?php $this->beginContent(__DIR__ . '/_layout.php', ['book' => $model->book]) ?>
  21. <div class="view-title">
  22. <h1><?= Html::encode($model->chapter_name) ?></h1>
  23. </div>
  24. <div class="view-content"><?= HtmlPurifier::process(Markdown::process($model->chapter_body)) ?></div>
  25. <!-- 评论 -->
  26. <?= \frontend\widgets\comment\CommentWidget::widget(['model' => $model]) ?>
  27. <?php $this->endContent() ?>
  28. <?php $this->registerJs("$('.view-content a').attr('target', '_blank');") ?>