[ PHPXref.com ] [ Generated: Sun Jul 20 16:35:25 2008 ] [ bBlog 0.7.6 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/bblog/bBlog_plugins/ -> function.getpost.php (source)

   1  <?php
   2  // function.getposts.php 
   3  //
   4  // Written by Reverend Jim <jim@revjim.net>
   5  //
   6  /*
   7  ** bBlog Weblog http://www.bblog.com/
   8  ** Copyright (C) 2003  Eaden McKee <email@eadz.co.nz>
   9  **
  10  ** This program is free software; you can redistribute it and/or modify
  11  ** it under the terms of the GNU General Public License as published by
  12  ** the Free Software Foundation; either version 2 of the License, or
  13  ** (at your option) any later version.
  14  **
  15  ** This program is distributed in the hope that it will be useful,
  16  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  ** GNU General Public License for more details.
  19  **
  20  ** You should have received a copy of the GNU General Public License
  21  ** along with this program; if not, write to the Free Software
  22  ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23  */
  24  function identify_function_getpost () {
  25  $help = '
  26  <p>The {getpost} function is used to retrieve a single post. It takes the following parameters:<br />
  27  <br />
  28  assign: variable to assign data to<br />
  29  postid: to request a SINGLE post';
  30  
  31    return array (
  32      'name'           =>'getpost',
  33      'type'             =>'function',
  34      'nicename'     =>'GetPost',
  35      'description'   =>'Gets a single blog post',
  36      'authors'        =>'Reverend Jim <jim@revjim.net>',
  37      'licence'         =>'GPL',
  38      'help'   => $help
  39    );
  40  }
  41  function smarty_function_getpost($params, &$bBlog) {
  42    $ar = array();
  43  
  44      // If "assign" is not set... we'll establish a default.
  45      if($params['assign'] == '') {
  46          $params['assign'] = 'post';
  47      }
  48      if($params['postid'] == '') {
  49          $bBlog->trigger_error('postid is a required parameter');
  50          return '';
  51      }
  52  
  53      $q = $bBlog->make_post_query(array("postid"=>$params['postid']));
  54  
  55      $ar['posts'] = $bBlog->get_posts($q);
  56          
  57      // No posts.
  58    if(!is_array($ar['posts'])) {
  59          return false;
  60      }
  61  
  62      $ar['posts'][0]['newday'] = 'yes';
  63      $ar['posts'][0]['newmonth'] = 'yes';
  64  
  65      $bBlog->assign($params['assign'],$ar['posts'][0]);
  66  
  67      return '';
  68          
  69  }
  70  
  71  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]