Location: PHPKode > projects > iBWd News > news/news.php
<?
// IF NECESSARY, CHANGE PATH TO CONFIG.PHP
require("./admin/config.php");
?>


<style>
.i{font-size: 11px; text-decoration: none}
</style>
<?

if (empty($offset)) {
    $offset=0;
}
$result = mysql_query("select count(date) from $table order by date DESC");
$numrows = mysql_result($result, 0, 0); 
$result = mysql_query("select * from $table order by date DESC limit $offset,$limit");
while (list($id,$title,$date,$poster,$mail,$news) = mysql_fetch_row($result)) {
	$d = explode("-",$date);
	$day = $d[2];
	$month = $d[1];
	$year = $d[0];
	$hour = $d[3];
	$min = $d[4];

	//############\\
	// dateformat:\\
	
	$thedate = "$day/$month/$year - $hour:$min";
	
	//############\\


	// NEWS FORMAT

	$print = "

		<table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">
		<tr>
		<td width=\"100%\" bgcolor=\"#EEEEEE\">
		<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
		<tr>
		<td><b>$title </b> by <a href=\"mailto:$mail\">$poster</a></td>
		<td>
		<p align=\"right\">$thedate</td>
		</tr>
		</table>
		</td>
		</tr>
		<tr>
		<td width=\"100%\">$news</td>
		</tr>
		</table>\n<br>\n
			
		";
	// END NEWS FORMAT

	echo $print;
}
// NEXT - PREVIOUS LINKS \\
echo"<center>";
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
    $pages++;
	if($pages > $limit){
	echo"<i>old news</i><br>";
	}
}
if ($offset != 0) {
    $prevoffset=$offset-$limit;
    echo "<a class=i href=\"$PHP_SELF?offset=$prevoffset\">&lt;&lt;</a> &nbsp; \n";
}
      
if ( $pages != 1 ) {
	
    for ($i=1;$i<=$pages;$i++) { 
        $newoffset=$limit*($i-1);
        if ( ((($offset)/$limit)==($i-1)) ) {
            echo "<font class=i>$i</font> &nbsp; \n";
        } else {
            echo "<a class=i href=\"$PHP_SELF?offset=$newoffset\">$i</a> &nbsp; \n";
        }
    }
}    
if (!((($offset)/$limit)+1==$pages) && $pages!=1) {
    $newoffset=$offset+$limit;
    echo "<a class=i href=\"$PHP_SELF?offset=$newoffset\">&gt;&gt;</a><p>\n";
}
echo"</center>";
?>
<!-- Please leave this line! -->
<br><p align="center"><a href="http://bramstart.be/ibwds"><font size="-2" face="Verdana">powered by iBWd scripts</font></a></p>
Return current item: iBWd News