當前位置: 首頁>>代碼示例>>PHP>>正文


PHP comments::getCommentCount方法代碼示例

本文整理匯總了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;
 }
開發者ID:RobMacKay,項目名稱:Ennui-CMS,代碼行數:45,代碼來源:class.blog.inc.php

示例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;
 }
開發者ID:RobMacKay,項目名稱:Ennui-CMS,代碼行數:40,代碼來源:class.search.inc.php


注:本文中的comments::getCommentCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。