2 printf("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n");
5 printf("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-15' />\n");
6 printf("<meta name='author' content='Frederik Vanrenterghem' />\n");
7 printf("<meta name='Description' content=\"Frederik Vanrenterghem's Blog\" />\n");
8 printf("<title>http://frederik.gotdns.org:1976 - News</title>\n");
9 printf("<link rel='stylesheet' type='text/css' href='/styles/main.css' />\n");
10 printf("<link rel='stylesheet' type='text/css' href='/styles/newspage.css' />\n");
11 printf("<link rel='stylesheet' type='text/css' href='/styles/header.css' />\n");
15 printf("<div class='thebody'>\n");
17 printf("<!--HEADER-->\n");
18 include("../header.shtml");
20 // Print the page title
21 printf("<h1>Blog</h1>\n\n");
23 // Define the variables
25 $dbserver="localhost";
27 $paswoord="BlaBla123";
32 if(isset($_GET['begin'])&&is_numeric($_GET['begin'])){
33 $begin=$_GET['begin'];
39 // -- Table structure for table 'newsContent'
42 // CREATE TABLE newsContent (
43 // title varchar(40) default NULL,
44 // date date default NULL,
48 // Connect to database
50 $db=mysql_connect($dbserver,$usernaam,$paswoord) or die ("Geen connectie met server");
51 mysql_select_db($database,$db) or die ("Database bestaat niet");
53 // Count the number of news items in the table
55 $aantalNewsItems=mysql_query("SELECT COUNT(*) from $tabel") 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.');
56 $aantalNewsItemsNo=mysql_fetch_row($aantalNewsItems);
59 // LIMIT x, y will limit the results to y rows, starting from x
61 $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("<div class='newsitem'>\n");
68 printf("<h1>%s</h1><h2><a href='/News/permalink.php?berichtID=%s'>%s</a></h2><p>%s</p>\n",
69 $resultatenrij[0], $resultatenrij[1], $resultatenrij[1], $resultatenrij[2]);
74 // Add some navigation - still to add option to modify maxShown
75 if($aantalNewsItemsNo[0]>$maxShown)
77 printf("<!--NAVIGATION-->\n");
78 printf("<div id='newsNav'>\n");
79 // Only show the option for the previous items on post-first-page
80 if($begin>0 AND $aantalNewsItemsNo[0]>($maxShown*2))
81 {printf("<H1><a href='index.php?begin=" . ($begin - $maxShown) . "'>Show items ".($begin-$maxShown+1) . " to " . ($begin) . "</a></h1>\n");}
82 // Show the next items, make sure not to mention a non-existing number of items with the min function
83 if($aantalNewsItemsNo[0]>($maxShown+$begin))
84 {printf("<h2><a href='index.php?begin=" .($begin+$maxShown)."'>Show items ".($begin+$maxShown+1) . " to " . min(($maxShown*2+$begin),$aantalNewsItemsNo[0]) . "</a></h2>\n");}
85 // Once we have shown all items, show the option to return to the first items
87 {printf("<h2><a href='index.php?begin=".(0)."'>Show items ".(1) . " to " . ($maxShown) . "</a></h2>\n");}
88 printf("<!--END NAVIGATION-->\n");
92 printf("<div id='RSS'>\n");
93 printf("<p><a href='/phppages/rss.php' title='Get the first 5 items of this News section in RSS XML format.'><img style='border:0' src='/Pics/xml.png' alt='XML RSS icon' /></a></p>\n");
97 printf("<div id='pagefooter'>\n");
98 include("../footer.php");