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


PHP post::find方法代碼示例

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


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

示例1: adminNotify

 public function adminNotify()
 {
     if ($this->cookie->check("id_user") and $this->cookie->id_user == 1) {
         //no notificamos a administrador de su propio comentario.
         return;
     }
     $id = $this->registry->lastCommentID;
     $Comment = new comment();
     $comment = $Comment->find($id);
     $comment['content'] = utils::nl2br($comment['content']);
     if (!defined('GESHI_VERSION')) {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content'], 'addTagPRE');
     } else {
         $comment['content'] = $this->comment_source_code_beautifier($comment['content']);
     }
     $User = new user();
     $user = $User->find(1);
     $Post = new post();
     $post = $Post->find($comment['ID_post']);
     $commentsWaiting = $Comment->countCommentsByPost(null, 'waiting');
     $mailStr = "\n\t\t\t<table width=\"100%\">\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<small>\n\t\t\t\t\t\t<strong>From IP</strong>: {$comment['IP']}<br />\n\t\t\t\t\t\t<strong>URL</strong>: <a href=\"{$comment['url']}\">{$comment['url']}</a><br />\n\t\t\t\t\t\t<strong>Email</strong>: <a href=\"mailto:{$comment['email']}\">{$comment['email']}</a><br />\n\t\t\t\t\t\t<strong>DateTime</strong>: {$comment['created']}<br />\n\t\t\t\t\t</small>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<strong>Author</strong>: {$comment['author']}<br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr><td><strong>Content</strong></td></tr>\n\t\t\t<tr><td bgcolor=\"#f7f7f7\">\n\t\t\t\t{$comment['content']}\n\t\t\t\t<hr />\n\t\t\t</td></tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tModerate comment: <a href=\"{$this->registry->path}comments/edit/{$comment['ID']}\">{$this->registry->path}comments/edit/{$comment['ID']}</a><br />\n\t\t\t\t\t\tView entry: <a href=\"{$this->registry->path}{$post['urlfriendly']}\">{$this->registry->path}{$post['urlfriendly']}</a>\n\t\t\t\t\t</p>\n\t\t\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThere are {$commentsWaiting} comments waiting for approbal. <br />\n\t\t\t\t\t\tPlease moderate comments: <a href=\"{$this->registry->path}comments/waiting\">{$this->registry->path}comments</a>\n\t\t\t\t\t</p>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t</table>\n\t\t";
     $conf = $this->registry->conf;
     $subject = "[{$conf['blog_name']}] Nuevo Comentario en: {$post['title']}";
     $this->enviaMail($user['email'], $subject, $mailStr, $user['email']);
 }
開發者ID:ravenlp,項目名稱:CodiceCMS,代碼行數:25,代碼來源:commentNotify.plugin.php

示例2: remove

 public function remove($id)
 {
     $P = new post();
     $P->find($id);
     $P->delete();
     $this->redirect("admin/");
 }
開發者ID:ravenlp,項目名稱:CodiceCMS,代碼行數:7,代碼來源:admin_controller.php

示例3: getNewsDetail

 /**
  * 獲取資訊相關信息
  * @param $news_id int 資訊id
  * @return array  
  */
 public function getNewsDetail($news_id)
 {
     $result = $data = post::find()->where(['news_active' => 0, 'news_id' => $news_id])->with(['stat' => function ($query) {
         return $query->select(['news_id', 'attr_stat_view_num', 'attr_stat_product_num', 'attr_stat_similar_news_num', 'attr_stat_user_num', 'attr_stat_tag_num', 'attr_stat_follow_num', 'attr_stat_like_num', 'attr_stat_comment_num']);
     }])->with(['attrs' => function ($query) {
         return $query->select(['news_id', 'attr_id', 'attr_value_text'])->where(['attr_id' => 4])->with(['tag' => function ($query) {
             return $query->select(['tag_id', 'tag_name']);
         }]);
     }])->with(['member' => function ($query) {
         return $query->select(['uid', 'nickname']);
     }])->asArray()->all();
     return $result;
 }
開發者ID:songhongyu,項目名稱:idaiyan,代碼行數:18,代碼來源:Post.php

示例4: getNewsMessage

 /**
  * 獲取資訊相關信息
  * @return array  
  */
 public function getNewsMessage($pager = 1, $isExecute = true)
 {
     $result = $data = post::find()->where(['news_active' => 0])->with(['stat' => function ($query) {
         return $query->select(['news_id', 'attr_stat_view_num', 'attr_stat_product_num', 'attr_stat_similar_news_num', 'attr_stat_user_num', 'attr_stat_tag_num', 'attr_stat_follow_num', 'attr_stat_like_num', 'attr_stat_comment_num']);
     }]);
     // $maxpager = intval($data->count() / self::PAGE_SIZE + 1);
     // if ($pager > $maxpager) {
     //     $pager = $maxpager;
     // }
     $startnum = ($pager - 1) * self::PAGE_SIZE;
     $result = $result->offset($startnum)->limit(self::PAGE_SIZE);
     $result = $result->orderBy(['news_id' => SORT_DESC]);
     if ($isExecute == true) {
         $result = $result->all();
     }
     return $result;
 }
開發者ID:songhongyu,項目名稱:idaiyan,代碼行數:21,代碼來源:Post.php

示例5: postEdit

 public function postEdit()
 {
     if (!Request::input('post_id') || Request::input('post_id') == '') {
         return redirect('admin/Post');
     }
     $v = Validator::make(Request::all(), Post::$rules);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     } else {
         $obj = post::find(Request::input('post_id'));
         $obj = $this->getDataPostObject('post', $obj);
         $obj->save();
         $this->inputLogs('Update data successful with ID = "' . $obj->post_id . '"');
         return redirect('admin/Post')->with('message', array('success' => 'Update data successful with ID = "' . $obj->post_id . '"'));
     }
 }
開發者ID:blackorwhite1233,項目名稱:laravel5,代碼行數:16,代碼來源:PostController.php


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