PhpSnip.com

User Stats

Easy news

Updat the news section on your site easily without using a database.

Info

 Download  View Source (print view)
 Rating : 4.7  Views : 558

Source Code ( 24 lines )

<?php

	function Show($filename, $author) {
		$filedate = filemtime("$filename");
		print "<table width=80% align=center border=1 cellpadding=2 bordercolor=#000000><tr width=100% align=center><td bordercolor=#FF0000><font face=Arial color=#FFFFFF>";
		print date("r", $filedate);
		print "</font></td></tr></table><table width=80% align=center><tr><td>";
		readfile("$filename");
		print "<p align=right><font color=#FFFFFF face=Arial>$author</font><br><br></p></td></tr></table>";
	}

	$newsdir = opendir("items/");
	while (false !== ($file = readdir($newsdir))) {
	    $newsitems[] = $file;
	}
	closedir($newsdir);
	rsort($newsitems);
	while (list($key, $val) = each($newsitems)) {
		if ($val != '.' and $val != "..") {
			$item = explode(".", $val);
			Show("items/" . $val, $item[1]);
		}
	}
?>

Search

Subscribe

  Rss Feeds

Sponsors

Advertise