Wheatblog PHP Cross Reference Blogging Systems

Source: /view_by_category.php - 77 lines - 2131 bytes - Summary - Text - Print

   1  <?php
   2  //
   3  // File:    view_by_category.php
   4  // License: GNU GPL
   5  //
   6  require_once ('./settings.php');
   7  $page_title = ':: category view';
   8  include_once("$wb_inc_dir/header.php");
   9  
  10  
  11      $the_cat = $_GET['the_category'];
  12      $The_cat = $db->quote($the_cat);
  13  
  14      // Select posts in the database that match the category
  15      // TODO: Paginate this.
  16      $db->query("select * from $tblPosts where category=$The_cat
  17          order by year DESC, month DESC, day DESC");
  18  
  19      echo("<!-- generated by wheatblog: start -->\n\n");
  20  
  21  
  22      $db2 = new DatabaseClass;
  23  
  24      while( $row = $db->fetchArray() )
  25      {
  26          $the_id     = $row['id'];
  27          $the_day    = $row['day'];
  28          $the_month  = $row['month'];
  29          $the_date   = $row['date'];
  30          $the_year   = $row['year'];
  31          $the_cat    = $row['category'];
  32          $the_locked = $row['locked'];
  33  
  34          // Parse out the category id into its string value
  35          $db2->query("select * from $tblCategories where id=$The_cat");
  36  
  37          while( $row2 = $db2->fetchArray() )
  38              $cat_name = $row2['category'];
  39  
  40          $the_showpref = $row['showpref'];
  41          $the_title    = $row['title'];
  42          $the_body     = $row['body'];
  43          $comments     = $row['comments'];
  44  
  45          // Post body
  46          //
  47          echo ("
  48              <div class=\"subcontent\">
  49              <div class=\"post-heading\">
  50              <h3 class=\"post-title\">$the_title</h3>
  51              <h4 class=\"post-date\">$the_day, $the_month.$the_date.$the_year</h4>
  52              </div> <!-- div.post-heading -->
  53              <div class=\"post-body\">$the_body</div>
  54          ");
  55  
  56          // Post category
  57          //
  58          echo ("
  59              <div class=\"post-menu\">
  60              <ul class=\"postnav\">
  61              <li title=\"Current Category\"><a href=\"view_by_category.php?the_category=$the_cat\">$cat_name</a></li>
  62          ");
  63  
  64          // Post comments
  65          //
  66          if ( $the_locked ) { 
  67          echo '<li title="Post is locked; click to view comments."><a href="view_by_permalink.php?the_id='.$the_id.'">Comments ('.$comments.')</a></li>'."\n";
  68          } else {
  69             echo '<li title="Add a Comment"><a href="view_by_permalink.php?the_id='.$the_id.'">Comments ('.$comments.')</a></li>'."\n";
  70          
  71          }
  72          echo "\n".'</ul>'."\n".'</div>'."\n";  # closes list and div.post-menu
  73          echo '</div>'."\n\n"; # closes div.indent
  74      }
  75  
  76  include_once("$wb_inc_dir/footer.php");
  77  ?>

title

Description

title

Description

title

Description

title

title

Body