Zend - The PHP Company




Files and Directories

Add Code


Easy news  

Type: code fragment
Added by: IceCreamMan
Entered: 26/03/2002
Last modified: 03/12/2001
Rating: - (fewer than 3 votes)
Views: 8523
Updat the news section on your site easily without using a database.


<?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]);
        }
    }
?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories