3 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-15">
4 <META NAME="Author" CONTENT="frederik.vanrenterghem@chello.be (Frederik Vanrenterghem)">
5 <META NAME="Description" CONTENT="Personal homepage - news">
6 <TITLE>http://frederik.gotdns.org:1976 - News</TITLE>
7 <style type="text/css" media="screen">
9 a.menu:link { color: #fff; background: #000084; text-decoration: none; }
10 a.menu:visited { color: #fff; background: #000084; text-decoration: none; }
14 <BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#55188A" ALINK="#FF0000">
17 printf("<!--HEADER-->\n");
18 include("../header.shtml");
20 // Print the page title
21 printf("<BR><H1>News Page</H1>\n\n");
23 // Define the variables
25 $dbserver="localhost";
32 if(!isset($begin)){$begin=0;}
34 if(ereg('[^0-9]', $begin)) {
35 die ('Invalid input format in URL. Please <a href="/About/index.shtml">contact the webmaster</a> if this problem persists.');
38 // -- Table structure for table 'newsContent'
41 // CREATE TABLE newsContent (
42 // title varchar(40) default NULL,
43 // date date default NULL,
47 // Connect to database
49 $db=mysql_connect($dbserver,$usernaam,$paswoord) or die ("Geen connectie met server");
50 mysql_select_db($database,$db) or die ("Database bestaat niet");
52 // Count the number of news items in the table
54 $aantalNewsItems=mysql_query("SELECT COUNT(*) from $tabel");
55 $aantalNewsItemsNo=mysql_fetch_row($aantalNewsItems);
58 // LIMIT x, y will limit the results to y rows, starting from x
60 $resultatenreeks=mysql_query("SELECT * FROM $tabel ORDER BY date DESC LIMIT $begin, $maxShown") or die ('An error occured while retrieving data from the database. Please <a href="/About/index.shtml">contact the webmaster</a> if this problem persists.');
63 while ($resultatenrij = mysql_fetch_row($resultatenreeks)) {
65 // Put the results in a table, one table per result
66 printf("<!--NEWSITEM-->\n");
67 printf("<table border='0' cellpadding='0' cellspacing='0' width='100%%' summary=''><tr><td><table bgcolor='#000084' border='0' cellpadding='0' cellspacing='0' width='100%%' summary=''>
68 <tr><td valign='top'><img src='/Pics/newsitem_ul.png' align='left' border='0' hspace='0' vspace='0' alt='cornerul' width='16' height='16'><font color=white><B>
70 </td><td align='right' valign='top'><img src='/Pics/newsitem_ur.png' align='right' border='0' hspace='0' vspace='0' alt='cornerur' width='16' height='16'><font color=white><B>
71 <A HREF='/News/permalink.php?berichtID=%s 'class='menu'>%s </A> </B></font></td></tr></table></td></tr><tr><td>
72 %s <BR><BR></td></tr></table>\n\n",
73 $resultatenrij[0], $resultatenrij[1], $resultatenrij[1], $resultatenrij[2]);
77 // Add some navigation - still to add option to modify maxShown
78 if($aantalNewsItemsNo[0]>$maxShown)
80 printf("<!--NAVIGATION-->\n");
81 printf("<table border='0' cellpadding='0' cellspacing='0' width='100%%' summary=''><tr><td align='left'>\n");
82 // Only show the option for the previous items on post-first-page
83 if($begin>0 AND $aantalNewsItemsNo[0]>($maxShown*2))
84 {printf("<a href='index.php?begin=" . ($begin - $maxShown) . "'>Show items ".($begin-$maxShown+1) . " to " . ($begin) . "</a><BR>\n");}
85 // Show the next items, make sure not to mention a non-existing number of items with the min function
86 if($aantalNewsItemsNo[0]>($maxShown+$begin))
87 {printf("</TD><TD align='right'><a href='index.php?begin=" .($begin+$maxShown)."'>Show items ".($begin+$maxShown+1) . " to " . min(($maxShown*2+$begin),$aantalNewsItemsNo[0]) . "</a></td></tr></table>\n");}
88 // Once we have shown all items, show the option to return to the first items
90 {printf("</TD><TD align='right'><a href='index.php?begin=".(0)."'>Show items ".(1) . " to " . ($maxShown) . "</a></td></tr></table>\n");}
91 printf("<!--END NAVIGATION-->\n");
94 // Include a link to an XML RSS feed
95 printf("<P><A HREF='/phppages/rss.php' title='Get the first 10 items of this News section in RSS XML format.'><IMG SRC='/Pics/xml.png' BORDER=0 ALT='XML RSS icon'></A></P>\n");
97 printf("<!--FOOTER-->\n");
98 include("../footer.php");