A program that uses text files to dynamically publish news in real time. The program for dynamically publishing news in real time can automatically arrange the display order according to the release time. News files are composed of text files stored in a specified directory. when there is news, programs that dynamically publish news in real time can automatically sort the display order according to the release time. A news file is a text file stored in a specified directory. when there is news, the program will automatically display it and arrange it in the first part of the page.
News
News
Bytes. A news file is composed of text files stored in a specified directory. when there is news, the program...
Include ('locationfilename. php ');Function createur1 ($ text ){// Insert your link in the text file of news// $ {Http://mysite.ch}// Or $ {http://mysite.ch | My homepage in}// Start to process text files$ S = $ text;$ A = strstr ($ s, '$ {');If ($ ){$ B = strstr ($ ,'}');If ($ B ){$ La = strlen ($ a); $ ls = strlen ($ s );$ S = substr ($ s, 0, $ ls-$ la );$ A = substr ($ a, 2 );$ Lb = strlen ($ B); $ la = strlen ($ );$ 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 );}Else {$ Linktext = $;}$ S = $ s. "". $ linktext. "". $ B;}}Return ($ s );}// Modify the NEWS file storage directory here// Remember, the news file must be a text file$ Newspath = "/home/htdocs/test/new /";// Set the array$ Newsfile = array ();// Set the directory handle$ Hd = dir ($ newspath );// Obtain all objects and store them in an array.While ($ filename = $ hd-> read ()){$ S = strtolower ($ filename );If (strstr ($ s, ". txt ")){// Check the latest modification date$ Lastchanged = filemtime ($ newspath. $ filename );$ Newsfile [$ filename] = $ lastchanged;}}// Sort filesArsort ($ newsfile );// Output fileFor (reset ($ newsfile); $ key = key ($ newsfile); next ($ newsfile )){$ Fa = file ($ newspath. $ key );$ N = count ($ fa );Print"
N "; Print"". Date (" d. m. Y-H: I: s ", $ newsfile [$ key])." N "; For ($ I = 0; $ I <$ n; $ I = $ I + 1 ){ $ S = chop ($ fa [$ I]); $ S = htmlspecialchars ($ s ); $ S = createur1 ($ s ); Print $ s ." N "; } Print" |
";}$ Hd-> close ();?>