本文整理汇总了PHP中Content::createPreview方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::createPreview方法的具体用法?PHP Content::createPreview怎么用?PHP Content::createPreview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::createPreview方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feed_list
private function feed_list($result, $mode)
{
if ($result instanceof DBObject) {
Backend::add('title', ConfigValue::get('Title'));
Backend::add('link', SITE_LINK . '/?q=content');
Backend::add('description', ConfigValue::get('Description'));
if (!empty($result->list) && is_array($result->list)) {
$list = array();
foreach ($result->list as $item) {
if (ConfigValue::get('CleanURLs', false)) {
$item['link'] = SITE_LINK . '/content/' . $item['id'];
} else {
$item['link'] = SITE_LINK . '/?q=content/' . $item['id'];
}
$item['body'] = Content::createPreview($item['body'], false);
$list[] = $item;
}
} else {
$list = false;
}
Backend::add('list', $list);
}
return $result;
}
示例2: feed_display
private function feed_display($result, $mode)
{
if (!$result instanceof DBObject) {
return $result;
}
Backend::add('title', $result->array['name']);
Backend::add('link', SITE_LINK . '/?q=tag/' . $result->array['id']);
Backend::add('description', $result->array['description']);
if (!empty($result->array['list']) && is_array($result->array['list'])) {
$list = array();
$max_time = 0;
foreach ($result->array['list'] as $item) {
$link = SITE_LINK;
if (Value::get('clean_urls', false)) {
$link .= $result->array['foreign_table'] . '/' . $item['id'];
} else {
$link .= '?q=' . $result->array['foreign_table'] . '/' . $item['id'];
}
$item['link'] = $link;
if ($result->array['foreign_table'] == 'contents') {
$item['body'] = Content::createPreview($item['body']);
}
$list[] = $item;
$max_time = strtotime($item['modified']) > $max_time ? strtotime($item['modified']) : $max_time;
}
Backend::add('AtomLastDate', gmdate('Y-m-d\\TH:i:s\\Z', $max_time));
} else {
$list = false;
}
Backend::add('list', $list);
return $result;
}
示例3:
<div class="content_preview box">
<h3><a href="?q=content/<?php
echo $content['name'];
?>
">
<?php
echo $content['title'];
?>
</a></h3>
<div>
<?php
echo Content::createPreview($content['body'], 100);
?>
</div>
<div class="bottom">
<a href="?q=content/<?php
echo $content['name'];
?>
">Read More</a>
</div>
</div>
示例4: foreach
?>
<?php
if ($list) {
foreach ($list as $item) {
?>
<entry>
<title><?php
echo htmlspecialchars($item['title']);
?>
</title>
<link href="<?php
echo $item['link'];
?>
" />
<summary type="html"><![CDATA[<?php
echo Content::createPreview($item['body']);
?>
]]></summary>
<updated><?php
echo gmdate('Y-m-d\\TH:i:s\\Z', strtotime($item['modified']));
?>
</updated>
<id><?php
echo $item['link'];
?>
</id>
</entry>
<?php
}
}
?>
示例5: foreach
foreach ($db_object->array['list'] as $item) {
$tags = Tag::getTags('contents', $item['id']);
$link = '?q=content/' . $item['name'];
?>
<h3>
<a href="<?php
echo $link;
?>
"><?php
echo plain($item['title']);
?>
</a>
</h3>
<p>
<?php
echo Content::createPreview($item['body'], false);
?>
</p>
<div class="clear">
<div class="span-3">
<a href="<?php
echo $link;
?>
">Read more</a>
</div>
<div class="span-6">
<?php
if ($tags) {
foreach ($tags as $tag) {
?>
<a href="?q=tag/<?php