Sorts old news by date

This commit is contained in:
Dan Olson 2000-05-15 20:58:46 +00:00
parent 5e4eb0b365
commit 701f501158
3 changed files with 29 additions and 31 deletions

View file

@ -1,31 +1,13 @@
<? // Preamble
$pageName = "News Archives";
$focused = "news"; // Dock icon name to gets a border
$pageName = "Page Name";
$focused = "none"; // Dock icon name to gets a border
require("parts/preamble.php"); // Load most of document
?>
?>
<!--SEARCHME-->
<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0">
<TR vAlign="top">
<TD colSpan="2"><? // News display
tableBoxHeader( 'black', tableHeadColor );
tableTitle( 'All News', 1, tableHeadColor );
require("news_funcs.php");
include("old_news.php");
tableBoxFooter();
?></TD>
</TR>
<TR vAlign=top>
<? tableSpacer(9, 9, 1, "black"); ?>
</TR>
<TR vAlign=top>
<TD align="center">
<? include("sponsor_incl.html"); ?>
</TD>
</TR>
<TR vAlign=top>
<? tableSpacer(9, 9, 1, "black"); ?>
</TR>
</TABLE>
Page content goes here. Yes, it's that simple.
<? require("news_funcs.php");
listMonths ();
?>
<!--NOSEARCH-->
<?
require("parts/postamble.php"); // Finish this sucker up

View file

@ -15,8 +15,8 @@
{
for ($month = $today['mon']+1 ; $month > 1 ; $month--)
{
echo '<P><A HREF="test2.php?mon=' .
date ("n", mktime (0,0,0,$month,0,0,0)) .
echo '<P><A HREF="old_news.php?mon=' .
date ("m", mktime (0,0,0,$month,0,0,0)) .
'&yr=' .
date ("Y", mktime (0,0,0,0,0,$today['year']+1,0)). '">' .
date ("F, Y", mktime (0,0,0,$month,0,$today['year'],0)) .

View file

@ -1,10 +1,23 @@
<?
need ('date sql');
if (((!is_int($yr)) || $yr < 2000)) $yr = date('Y',time());
if ($mon < 1 || $mon > 12) $mon = date('m',time());
$pageName = 'News: '. date("F, Y", mktime(0,0,0,$mon+1,0,$yr,0));
$focused = "none";
require("parts/preamble.php"); // Load most of document
need ('date sql');
require ("news_funcs.php");
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign="top"> <TD colSpan="2">';
tableBoxHeader( 'black', tableHeadColor );
tableTitle( $pageName, 1, tableHeadColor );
$mydate = $yr . '-' . $mon;
$conn = mysql_pconnect (sqlHost, sqlUser, sqlPass);
if ($conn) {
$query = 'SELECT n_date, n_user, n_news FROM news_main' .
' ORDER BY n_date DESC';
$query = 'SELECT n_date, n_user, n_news FROM news_main WHERE '.
'n_date BETWEEN \'' . $mydate . '-00 00:00:00\' AND '.
'\'' . $mydate . '-31 23:59:59\'' .
' ORDER BY n_date DESC';
$result = mysql_db_query (sqlDB, $query, $conn);
if ($result) {
$numRows = mysql_num_rows ($result);
@ -14,7 +27,7 @@
newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
}
} else {
newsItem ('now', 'Web Server', '<P>No current news!');
newsItem ('now', 'Web Server', '<P>No news for this month!');
}
} else {
newsItem ('now', 'Web Server', '<P>No news in database!');
@ -23,4 +36,7 @@
} else {
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
}
tableBoxFooter();
echo '</TD></TR></TABLE>';
require("parts/postamble.php");
?>