本文整理汇总了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 -->