[ 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.getsections.php (source)

   1  <?php
   2  // function.getsections.php 
   3  //
   4  // Written by Elie `LordWo` BLETON <lordwo_REM_OVE_THIS@laposte.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  
  25  function identify_function_getsections () 
  26  {
  27  $help = '
  28  <p>the {getsections} function is used to retrieve all the sections available on the blog, and generate appropriate links.<br /><br />
  29  This function accept a <u>separator</u> parameter, which is a string. Alternatively you can use a <u>before</u> and <u>after</u> parameter. It can be any HTML (or XHTML) code that you want, it will be pasted between each section link. <br /><br />
  30  Another parameter is the <u>limit</u> parameter. If set to "content" it will only list sections that links to a specific content. 
  31  If set to "blog", it will only list sections that are bblog-powered. Else, the "both" value will list... both ;) (Default value is "both")
  32  ';
  33    return array (
  34      'name'           =>'getsections',
  35      'type'           =>'function',
  36      'nicename'       =>'GetSections',
  37      'description'    =>'Retrieves sections and generate links.<br>This doesn\'t use internal bBlog functions, as they crash Apache2/PHP5. Consider this as a workaround.',
  38      'authors'        =>'Elie `LordWo` BLETON <lordwo_REM_OVE_THIS@laposte.net>',
  39      'licence'        =>'GPL',
  40      'help'           => $help
  41    );
  42  }
  43  
  44  function smarty_function_getsections($params, &$bBlog) 
  45  {
  46  
  47      if (!T_SECTIONS) 
  48      { 
  49            die("Some problem around the definition of T_SECTION"); 
  50        }    // Temporary bugtrap to see if i'm right. (lordwo)
  51    
  52        // Default values
  53        if (!isset($params['limit'])) 
  54        { 
  55            $params['limit'] = 'both'; 
  56        }
  57    
  58      if (isset($params['separator'])) 
  59      { 
  60          $params['after'] = $params['separator']; 
  61          $params['before'] = '';
  62      }
  63    
  64        // Retrieving data
  65        $bBlog->get_sections();
  66    
  67        // Generating links
  68        $i = 0;
  69        foreach ($bBlog->sections as $row) 
  70        {
  71          if ($params['limit'] == 'both')                                         { $print = TRUE;     }
  72            elseif (($params['limit'] == 'content') && ($row->content != ''))     { $print = TRUE;     }
  73            elseif (($params['limit'] == 'blog') && ($row->content == ''))         { $print = TRUE;     }
  74            else                                                                     { $print = FALSE;     }
  75        
  76            if ($print == TRUE) 
  77            { 
  78              $i++;
  79              $returned_values .= $params['before']."<a href='?sectionid=".$row->sectionid."'>".$row->nicename."</a>".$params['after']; 
  80            }      
  81        }
  82    
  83        // Return  
  84        return $returned_values;
  85  }
  86  
  87  ?>


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