コード例 #1
0
ファイル: comments.php プロジェクト: totojack/yii2-comments
/* @var $this yii\web\View */
/* @var $model yeesoft\comments\models\Comment */
$commentsPage = Yii::$app->getRequest()->get("comment-page", 1);
$cacheKey = 'comment' . $model . $model_id . $commentsPage . substr(\Yii::$app->language, 0, 2);
//SIMONE forse non indispensabile, ma logico
$cacheProperties = CommentsHelper::getCacheProperties($model, $model_id);
?>
<div class="comments">
    <?php 
if ($this->beginCache($cacheKey . '-count', $cacheProperties)) {
    ?>
        <h5><?php 
    echo Comments::t('comments', 'All Comments');
    ?>
 (<?php 
    echo Comment::activeCount($model, $model_id);
    ?>
)</h5>
        <?php 
    $this->endCache();
    ?>
    <?php 
}
?>

    <?php 
if (!Comments::getInstance()->onlyRegistered || !Yii::$app->user->isGuest) {
    ?>
        <div class="comments-main-form">
            <?php 
    echo CommentsForm::widget();