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

   1  <?php
   2  /*********************************\
   3  ÊÊbbBlog Plugin: 
   4  ÊÊÊBuild Archive Months Listing 
   5  Copyright
   6  ÊÊÊ2004 Chris Boulton 
   7  ÊÊÊ<c.boulton@mybboard.com> 
   8  \*********************************/
   9  function identify_function_archivemonths() {
  10  return array("name" => "archivemonths",
  11  "type" => "function",
  12  "nicename" => "Archive Month Listing",
  13  "description" => "Generates a list of archive months",
  14  "authors" => "c.boulton@mybboard.com");
  15  }
  16  function smarty_function_archivemonths($params, &$bBlog) {
  17  $num = 10;
  18  $sep = "<br />";
  19  $year = "";
  20  $showcount = 0;
  21  extract($params);
  22  if($year) {
  23  $where = " AND YEAR(FROM_UNIXTIME(posttime)) = '$year'";
  24  }
  25  if($num) {
  26  $num = " LIMIT 0, $num";
  27  }
  28  $query = mysql_query("SELECT DISTINCT YEAR(FROM_UNIXTIME(posttime)) AS year, MONTH(FROM_UNIXTIME(posttime)) AS month, COUNT(postid) AS posts FROM ".T_POSTS." $where GROUP BY YEAR(FROM_UNIXTIME(posttime)), MONTH(FROM_UNIXTIME(posttime)) ORDER BY posttime DESC $limit;");
  29  while($month = mysql_fetch_array($query)) {
  30  if($month[month] < 10) {
  31  $month[month] = "0$month[month]";
  32  }
  33  $monthslist .= "<a href=\"archives.php?month=$month[month]&year=$month[year]\">".getmonthfriendlyname($month[month])." $month[year]</a> ";
  34  if($showcount) {
  35  $monthslist .= " <i>$month[posts]</i>";
  36  }
  37  $monthslist .= "$sep";
  38  }
  39  return $monthslist;
  40  }
  41  function getmonthfriendlyname($month) {
  42  $tstamp = mktime(0, 0, 0, $month);
  43  return date("F", $tstamp);
  44  }
  45  ?>


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