A program for dynamically publishing news in real time, which can automatically arrange the display sequence according to the release time. News files are text files stored in the specified directory. When there is news, the program will automatically display it and arrange it at the beginning of the page.
News
News
include('locationfilename.php');
function createur1($text){ / /Insert your link into the news text file like this //${http://mysite.ch} //Or ${http://mysite.ch|My homepage in} //Start processing the text file part $s=$text; $a=strstr($s,'${'); if ($a){ $b=strstr( $a,'}'); if ($b){ $la=strlen($a); $ls=strlen($s); $s=substr($s,0 ,$ls-$la); $a=substr($a,2); $lb=strlen($b); $la=strlen($a); $a=substr ($a,0,$la-$lb); $b=substr($b,1); $ta=strstr($a,"|"); if($ta){ $la=strlen($a); $lt=strlen($ta); $linktext=substr($a,$la-$lt+1); $a=substr($a ,0,$la-$lt); $a."">".$linktext."".$b; } }
return($s); }
//Modify your news file storage directory here //Remember, news files must be text files $newspath="/home/htdocs/test/new/";
//Set the array $newsfile=array();
//Set the directory handle $hd=dir($newspath);
//Get all files, And store it in the array while($filename=$hd->read() ){ $s=strtolower($filename); if (strstr($s,".txt ")){ //Detect the latest modification date $lastchanged=filemtime($newspath.$filename); $newsfile[$filename]=$lastchanged; } }
http://www.bkjia.com/PHPjc/316336.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316336.htmlTechArticleA program for dynamically publishing news in real time, which can automatically arrange the display order according to the release time. News files are text files stored in the specified directory. When there is news, the program...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn