本文整理匯總了PHP中ContentHelper::cutStringEx方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentHelper::cutStringEx方法的具體用法?PHP ContentHelper::cutStringEx怎麽用?PHP ContentHelper::cutStringEx使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContentHelper
的用法示例。
在下文中一共展示了ContentHelper::cutStringEx方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
<div class="rubric">
<?php
echo $data['content'];
?>
</div>
<?php
if ($data['is_active']) {
?>
<ul class="photo-list">
<?php
foreach ($photos as $photo) {
?>
<?php
$description = ContentHelper::cutStringEx($photo['description'], 100);
$imgThumbUrl = ImageHelper::imageUrl('portfolio_index_frontend', $photo['filename']);
$imgRawUrl = ImageHelper::imageUrl('raw', $photo['filename']);
?>
<li>
<a class="fancybox-button" rel="fancybox-button" href="<?php
echo $imgRawUrl;
?>
" title="<?php
echo $description;
?>
">
<img src="<?php
echo $imgThumbUrl;
?>
" alt="<?php
示例2: foreach
<ul class="album-list article-album">
<?php
foreach ($data as $blogs) {
?>
<?php
$arr = explode(' ', $blogs['publication_date']);
$timestamp = CDateTimeParser::parse($blogs['publication_date'], 'yyyy-MM-dd hh:mm:ss');
$date = Yii::app()->dateFormatter->format('d MMMM y', $timestamp);
$title = ContentHelper::cutStringEx($blogs['p_title'], 100);
$imgUrl = ImageHelper::imageUrl('blogs_slider', $blogs['filename']);
?>
<li title="<?php
echo $title;
?>
">
<a href="<?php
echo Yii::app()->createAbsoluteUrl('blogs/default/view', array('id' => $blogs['id']));
?>
">
<img style="width: 335px; height: 228px;" src="<?php
echo $imgUrl;
?>
" alt="<?php
echo $title;
?>
" title="<?php
echo $title;
?>
">
<span>
<span class="album-title"><?php
示例3:
<?php
$url = yii::app()->createAbsoluteUrl('portfolio/default/view/id/' . $data['post_id']);
$anounce = $data['anounce'];
$imgUrl = ImageHelper::imageUrl('portfolio_index_frontend', $data['filename']);
$title = ContentHelper::cutStringEx($data['p_title'], 100);
$timestamp = CDateTimeParser::parse($data['publication_date'], 'yyyy-MM-dd hh:mm:ss');
$date = Yii::app()->dateFormatter->format('d MMMM y', $timestamp);
$author = $data['firstname'] . ' ' . $data['lastname'];
?>
<li>
<a href="<?php
echo $url;
?>
">
<img src="<?php
echo $imgUrl;
?>
" alt="">
<span>
<span class="album-title"><?php
echo $title;
?>
</span>
<p><?php
echo $data['anounce'];
?>
</p>
<span class="album-date"><?php
echo $author;