当前位置: 首页>>代码示例>>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;未经允许,请勿转载。