本文整理汇总了PHP中comments::getCommentCount方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::getCommentCount方法的具体用法?PHP comments::getCommentCount怎么用?PHP comments::getCommentCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::getCommentCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayPreview
protected function displayPreview($entries)
{
$entry = $this->admin_general_options($this->url0);
$entry_array = array();
if (isset($entries[0]['title'])) {
foreach ($entries as $e) {
$e['site-url'] = SITE_URL;
// Format the date from the timestamp
$e['date'] = date('F d, Y', $e['created']);
// Image options
if (!empty($e['img'])) {
// Display the latest two galleries
$e['image'] = $e['img'];
$e['preview'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'preview/', $e['img']);
$e['thumb'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'thumbs/', $e['img']);
} else {
$e['image'] = '/assets/images/no-image.jpg';
$e['preview'] = '/assets/images/no-image.jpg';
$e['thumb'] = '/assets/images/no-image-thumb.jpg';
}
$e['comment-count'] = comments::getCommentCount($e['id']);
$e['comment-text'] = $e['comment-count'] == 1 ? "comment" : "comments";
$e['url'] = !empty($e['data6']) ? $e['data6'] : urlencode($e['title']);
$e['tags'] = $this->_formatTags($e['data2']);
$e['admin'] = $this->admin_simple_options($this->url0, $e['id']);
$entry_array[] = $e;
}
$template_file = $this->url0 . '-preview.inc';
} else {
$entry_array[] = array('admin' => NULL, 'title' => 'No Entry Found', 'body' => "<p>That entry doesn't appear to exist.</p>");
$template_file = 'blog-preview.inc';
}
if ($this->url1 == "category") {
$extra['header']['title'] = "Entries Tagged with " . ucwords(str_replace('-', ' ', $this->url2));
} else {
$extra['header']['title'] = "Recent Entries";
}
$extra['footer']['pagination'] = $this->paginateEntries();
/*
* Load the template into a variable
*/
$template = UTILITIES::loadTemplate($template_file);
$entry .= UTILITIES::parseTemplate($entry_array, $template, $extra);
return $entry;
}
示例2: displayResults
protected function displayResults($entries)
{
$entry = $this->admin_general_options($this->url0);
$entry_array = array();
if (isset($entries[0]['title'])) {
foreach ($entries as $e) {
$e['site-url'] = SITE_URL;
// Format the date from the timestamp
$e['date'] = date('F d, Y', $e['created']);
// Image options
if (!empty($e['img']) && strlen($e['img']) > 1) {
// Display the latest two galleries
$e['image'] = $e['img'];
$e['preview'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'preview/', $e['img']);
$e['thumb'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'thumbs/', $e['img']);
} else {
$e['image'] = '/assets/images/no-image.jpg';
$e['preview'] = '/assets/images/no-image.jpg';
$e['thumb'] = '/assets/images/no-image-thumb.jpg';
}
$e['comment-count'] = comments::getCommentCount($e['id']);
$e['comment-text'] = $e['comment-count'] == 1 ? "comment" : "comments";
$e['url'] = !empty($e['data6']) ? $e['data6'] : urlencode($e['title']);
$e['admin'] = $this->admin_simple_options($this->url0, $e['id']);
$entry_array[] = $e;
}
$template_file = $this->url0 . '.inc';
} else {
$entry_array[] = array('admin' => NULL, 'title' => 'No Entries Found That Match Your Search', 'body' => "<p>No entries match that query.</p>");
$template_file = 'default.inc';
}
$extra['header']['title'] = 'Search Results for "' . urldecode($this->url2) . '" (' . $this->getEntryCountBySearch($this->url2, $this->url1) . ' entries found)';
$extra['footer']['pagination'] = $this->paginateEntries();
/*
* Load the template into a variable
*/
$template = UTILITIES::loadTemplate($template_file);
$entry .= UTILITIES::parseTemplate($entry_array, $template, $extra);
return $entry;
}