本文整理汇总了PHP中Story::getPreviewText方法的典型用法代码示例。如果您正苦于以下问题:PHP Story::getPreviewText方法的具体用法?PHP Story::getPreviewText怎么用?PHP Story::getPreviewText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Story
的用法示例。
在下文中一共展示了Story::getPreviewText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: STORY_renderArticle
//.........这里部分代码省略.........
// Need to reset especially if caching is disabled for a certain story but template caching has been enabled for the theme
$retval = false;
}
}
$articleUrl = COM_buildURL($_CONF['site_url'] . '/article.php?story=' . $story->getSid());
$article->set_var('article_url', $articleUrl);
$article->set_var('story_title', $story->DisplayElements('title'));
// Date formatting set by user therefore cannot be cached
$article->set_var('story_date', $story->DisplayElements('date'), false, true);
$article->set_var('story_datetime', $story->DisplayElements('datetime'), false, true);
// Story views increase with every visit so cannot be cached
if ($_CONF['hideviewscount'] != 1) {
$article->set_var('lang_views', $LANG01[106], false, true);
$article->set_var('story_hits', $story->DisplayElements('hits'), false, true);
}
// Topic Icon is user configurable so do not cache
$topicname = $story->DisplayElements('topic');
$topicurl = COM_buildURL($_CONF['site_url'] . '/index.php?topic=' . $story->DisplayElements('tid'));
if ((!isset($_USER['noicons']) || $_USER['noicons'] != 1) && $story->DisplayElements('show_topic_icon') == 1) {
$imageurl = $story->DisplayElements('imageurl');
if (!empty($imageurl)) {
$imageurl = COM_getTopicImageUrl($imageurl);
$article->set_var('story_topic_image_url', $imageurl, false, true);
$topicimage = '<img src="' . $imageurl . '" class="float' . $_CONF['article_image_align'] . '" alt="' . $topicname . '" title="' . $topicname . '"' . XHTML . '>';
$article->set_var('story_anchortag_and_image', COM_createLink($topicimage, $topicurl, array()), false, true);
$article->set_var('story_topic_image', $topicimage, false, true);
$topicimage_noalign = '<img src="' . $imageurl . '" alt="' . $topicname . '" title="' . $topicname . '"' . XHTML . '>';
$article->set_var('story_anchortag_and_image_no_align', COM_createLink($topicimage_noalign, $topicurl, array()), false, true);
$article->set_var('story_topic_image_no_align', $topicimage_noalign, false, true);
}
}
// Main article content
if ($index == 'p') {
$introtext = $story->getPreviewText('introtext');
$bodytext = $story->getPreviewText('bodytext');
} else {
$introtext = $story->displayElements('introtext');
$bodytext = $story->displayElements('bodytext');
}
$readmore = empty($bodytext) ? 0 : 1;
$numwords = COM_numberFormat(count(explode(' ', COM_getTextContent($bodytext))));
if (COM_onFrontpage()) {
$bodytext = '';
}
if (!empty($query)) {
$introtext = COM_highlightQuery($introtext, $query);
$bodytext = COM_highlightQuery($bodytext, $query);
}
// Create article only if preview, or query not empty, or if no cache version or cache version is not required
if ($index == 'p' || !empty($query) || !$retval) {
$article->set_var('article_filevar', '');
$article->set_var('site_name', $_CONF['site_name']);
//$article->set_var( 'story_date', $story->DisplayElements('date') );
$article->set_var('story_date_short', $story->DisplayElements('shortdate'));
$article->set_var('story_date_only', $story->DisplayElements('dateonly'));
$article->set_var('story_id', $story->getSid());
if ($_CONF['contributedbyline'] == 1) {
$article->set_var('lang_contributed_by', $LANG01[1]);
$article->set_var('contributedby_uid', $story->DisplayElements('uid'));
$fullname = $story->DisplayElements('fullname');
$username = $story->DisplayElements('username');
$article->set_var('contributedby_user', $username);
if (empty($fullname)) {
$article->set_var('contributedby_fullname', $username);
} else {
$article->set_var('contributedby_fullname', $fullname);