当前位置: 首页>>代码示例>>PHP>>正文


PHP post::findAll方法代码示例

本文整理汇总了PHP中post::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP post::findAll方法的具体用法?PHP post::findAll怎么用?PHP post::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在post的用法示例。


在下文中一共展示了post::findAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPosts

 public function getPosts($status = null, $limitQuery = null)
 {
     $P = new post();
     $posts = array();
     if (is_null($status) === true) {
         $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, null);
     } else {
         if (is_array($status) === false) {
             $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE status='{$status}'");
         } else {
             $status_sql = "";
             foreach ($status as $st) {
                 $status_sql .= "status ='{$st}' OR ";
             }
             $status_sql = substr($status_sql, 0, -3);
             $posts = $P->findAll("ID,id_user,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", 'ID DESC', $limitQuery, "WHERE ({$status_sql})");
         }
     }
     $C = new comment();
     foreach ($posts as $k => $p) {
         $posts[$k]['title'] = htmlspecialchars($posts[$k]['title']);
         $posts[$k]['tags'] = $this->getTags($posts[$k]['ID']);
         $posts[$k]['comments_count'] = $C->countCommentsByPost($posts[$k]['ID'], "publish");
         $U = new user();
         if ($posts[$k]['id_user'] < 2) {
             $posts[$k]['autor'] = $U->find(1);
         } else {
             $posts[$k]['autor'] = $U->find($posts[$k]['id_user']);
         }
     }
     return $posts;
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:32,代码来源:post.php

示例2: rss

 public function rss($id = NULL)
 {
     $this->plugin->call('feed_header');
     $post = new post();
     $this->view->conf = $this->conf;
     $this->view->setLayout("feed");
     $posts = $post->findAll("ID,urlfriendly,title,IF(POSITION('<!--more-->' IN content)>0,MID(content,1,POSITION('<!--more-->' IN content)-1),content) as content, created", "ID DESC", $this->conf['blog_posts_per_page'], "WHERE status = 'publish'");
     $temp = array();
     foreach ($posts as $a_post) {
         $temp[$a_post['ID']] = $a_post;
         $temp[$a_post['ID']]['tags'] = $post->getTags($a_post['ID'], 'string');
     }
     $this->view->posts = $temp;
     $this->render("rss");
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:15,代码来源:feed_controller.php

示例3: index

 public function index($id = NULL)
 {
     $P = new post();
     $total_rows = $P->countPosts();
     $page = $id;
     $page = is_null($page) ? 1 : $page;
     $limit = $this->userConf['posts_per_page'];
     $offset = ($page - 1) * $limit;
     $limitQuery = $offset . "," . $limit;
     $targetpage = $this->path . 'admin/index/';
     $pagination = $this->pagination->init($total_rows, $page, $limit, $targetpage);
     $this->title_for_layout("Administraci&oacute;n - Codice CMS");
     $this->view->pagination = $pagination;
     $this->view->posts = $P->findAll(NULL, "ID DESC", $limitQuery, NULL);
     $this->view->blogConfig = $this->blogConfig;
     $this->view->userConf = $this->userConf;
     $this->view->setLayout("admin");
     $this->render();
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:19,代码来源:admin_controller.php


注:本文中的post::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。