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


PHP comment::findAll方法代碼示例

本文整理匯總了PHP中comment::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP comment::findAll方法的具體用法?PHP comment::findAll怎麽用?PHP comment::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在comment的用法示例。


在下文中一共展示了comment::findAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAll

 public function getAll($ID_post, $status = null)
 {
     $C = new comment();
     $rows = array();
     if (is_null($status) === true) {
         $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post}");
     } else {
         if (is_array($status)) {
             $status_sql = "";
             foreach ($status as $st) {
                 $status_sql .= "status = '{$st}' OR ";
             }
             $status_sql = substr($status_sql, 0, -4);
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND ({$status_sql})");
         } else {
             $rows = $C->findAll('comments.*, md5(comments.email) as md5_email', 'created ASC', null, "WHERE ID_post={$ID_post} AND status='{$status}'");
         }
     }
     foreach ($rows as $key => $comment) {
         $comment['content'] = utils::htmlentities($comment['content']);
         $comment['content'] = utils::nl2br($comment['content']);
         $rows[$key] = $comment;
     }
     return $rows;
 }
開發者ID:ravenlp,項目名稱:CodiceCMS,代碼行數:25,代碼來源:comment.php

示例2: index

 public function index($id = NULL)
 {
     $this->view->setLayout("admin");
     $this->view->conf = $this->conf;
     $this->title_for_layout($this->l10n->__("Comentarios - Codice CMS"));
     $comment = new comment();
     $total_rows = $comment->countCommentsByPost();
     $page = $id;
     $page = is_null($page) ? 1 : $page;
     $limit = $this->userConf['posts_per_page'];
     $offset = ($page - 1) * $limit;
     $limitQuery = $offset . "," . $limit;
     $targetpage = $this->path . 'comments/';
     $pagination = $this->pagination->init($total_rows, $page, $limit, $targetpage);
     $this->view->pagination = $pagination;
     $comments = $comment->findAll(NULL, "ID DESC", $limitQuery, NULL);
     foreach ($comments as $key => $value) {
         $Post = new post();
         $post = $Post->findBy('ID', $value['ID_post']);
         $value['post'] = array('urlfriendly' => $post['urlfriendly'], 'title' => $post['title']);
         $value["content"] = utils::htmlentities($value["content"]);
         $value["content"] = utils::nl2br($value["content"]);
         $comments[$key] = $value;
     }
     $this->registry->comments = $comments;
     $this->plugin->call("comments_comment_content");
     $this->view->comments = $this->registry->comments;
     $this->render();
 }
開發者ID:ravenlp,項目名稱:CodiceCMS,代碼行數:29,代碼來源:comments_controller.php

示例3: usersNotify

 public function usersNotify()
 {
     $postID = $this->registry->postID;
     $lastCommentID = $this->registry->lastCommentID;
     $Comment = new comment();
     $comment = $Comment->find($lastCommentID);
     $Post = new post();
     $post = $Post->find($postID);
     if ($comment['status'] != 'publish') {
         return;
     }
     $Comment = new comment();
     $usersToNotify = $Comment->findAll("email,author,created,ID,content", "ID DESC", null, "WHERE suscribe = 1 AND NOT user_id = 1 AND status = 'publish' AND id_post = {$postID} GROUP BY email");
     if (!$usersToNotify) {
         return;
     }
     $mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\tHay un nuevo comentario en la entrada \"<a href=\"{$this->registry->path}{$post['urlfriendly']}#comments\">{$post['title']}</a>\".<br />\n\t\t\t\t\t<small><a href=\"{$this->registry->path}{$post['urlfriendly']}#comments\">{$this->registry->path}{$post['urlfriendly']}</a></small><br /><br />\n\t\t\t\t\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t\t<strong>Comentario</strong>: <br />\n\t\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tLee aquí todos los comentarios de esta entrada:<br />\n\t\t\t\t\t\t<a href=\"{$this->registry->path}{$post['urlfriendly']}#comments\">{$this->registry->path}{$post['urlfriendly']}</a><br />\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t";
     $conf = $this->registry->conf;
     $subject = "[{$conf['blog_name']}] haz recibido respueta a tu comentario en: {$post['title']}";
     $suscribers = array();
     foreach ($usersToNotify as $mail) {
         $this->enviaMail($mail['email'], $subject, $mailStr, null);
     }
 }
開發者ID:ravenlp,項目名稱:CodiceCMS,代碼行數:24,代碼來源:commentNotify.plugin.php


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