<?php
//
// File: view_by_title.php
// License: GNU GPL
// Purpose: Echoes out blog posts and links for adding comments, etc.
//
require_once('./settings.php');
$page_title = ':: view by title';
include_once("$wb_inc_dir/header.php");
// Connect to the RDBMS and select the database.
$db = DB_connect($site, $user, $pass);
DB_select_db($database, $db);
// select recent posts in the database
$result = DB_query("select *
from $tblPosts
where showpref = '1'
order by year DESC, month DESC, date DESC, id DESC", $db);
// output the current entries
echo("<!-- generated by wheatblog: start -->\n\n");
echo("\n\n".'<div class="subcontent">'."\n");
# code in progress
# tables actually serve a legit purpose, I swear
echo '<table id="vb-table" width="100%" cellpadding="0" cellspacing="0">'.
'<thead>'.
'<tr id="vb-heading">
<th width="45%">' . TITLE_OF_POST . '</th>
<th width="15%">' . POSTED_ON . '</th>
<th width="20%">' . CATEGORY . '</th>
<th width="20%">' . COMMENTS . '</th>
</tr>
</thead>';
echo '<tbody>'."\n";
while($row = DB_fetch_array($result)) {
$the_id = $row["id"];
// $the_day = $row["day"];
$the_month = $row["month"];
$the_date = $row["date"];
$the_year = $row["year"];
$the_category = $row["category"];
// parse out the category id into its string value
$result2 = DB_query("select *
from $tblCategories
where id = '$the_category'", $db);
while($row2 = DB_fetch_array($result2)) {
$the_category_name = $row2["category"];
}
$the_showpref = $row['showpref'];
$the_title = $row['title'];
$comments = $row['comments'];
// posts
// echo("\n\n<div class=\"indent\">\n");
# JBE - removed interpolation
# JBE - modified output into tables, yippee
echo '<tr class="vb-body">';
echo '<td class="td-title"><span><a href="view_by_permalink.php?the_id='.$the_id.'">'.$the_title.'</a></span></td>'."\n";
echo '<td class="vb-td"><span>'.$the_month."/".$the_date."/".$the_year.'</span></td>'."\n";
// echo("$the_body" . "<br />\n");
echo '<td class="vb-td"><span><a href="view_by_category.php?the_category='.$the_category.'">'.$the_category_name.'</a></span></td>'."\n";
echo '<td class="vb-td"><span><a href="view_by_permalink.php?the_id='.$the_id.'">'.'comments ('.$comments.')'.'</a></span></td>'."\n";
echo '</tr>';
//echo("</div>\n");
}
echo '</tbody>'."\n".'</table>'."\n".'</div>';
// include the footer
include_once("$wb_inc_dir/footer.php");
?>