本文整理匯總了PHP中yii\helpers\StringHelper::countWords方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringHelper::countWords方法的具體用法?PHP StringHelper::countWords怎麽用?PHP StringHelper::countWords使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\helpers\StringHelper
的用法示例。
在下文中一共展示了StringHelper::countWords方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
use yii\helpers\StringHelper;
use yii\widgets\ListView;
/* @var $dataProvider hiqdev\hiart\ActiveDataProvider */
?>
<!-- TESTIMONIALS -->
<div class="testimonials">
<div class="row">
<div class="col-sm-12">
<h3><?php
echo Yii::t('hisite/news', 'Our news');
?>
</h3>
<hr class="hr-awesome">
<?php
echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model) {
$out = sprintf("<div class=\"testimonial-content\">\n <h3>%s</h3>\n <span>%s</span>\n <p>%s</p>\n </div>", Html::a(Html::encode($model->translation->title), ['/news/article/view', 'id' => $model->id]), Yii::$app->formatter->asDate($model->post_date), StringHelper::countWords($model->translation->short_text) !== 0 ? strip_tags($model->translation->short_text) : '', Html::a(Yii::t('hisite/news', 'Read more'), ['/news/article/view', 'id' => $model->id]));
return $out;
}, 'layout' => "{items}", 'options' => ['id' => 'testimonials-carousel', 'class' => 'owl-carousel']]);
?>
<p class="text-center md-mt-50">
<?php
echo Html::a(Yii::t('hisite/news', 'READ ALL NEWS'), ['/news/article/index'], ['class' => 'mtr-btn button-purple ripple btn-lg order-vps has-ripple']);
?>
</p>
</div>
</div>
</div>
<!-- END OF TESTIMONIALS -->