Dynamic real-time release of news programs, according to the release time, automatically arrange the display order. News files are composed of text files stored in the specified directory, and when there is news, the program automatically displays them and arranges them at the beginning of the page.
<title>News</title>
<body bfcolor= "#ffffff" >
<div aligh= "center" >
<table border= "0" cellspacing= "5" cellpadding= "ten" width= "90%" bgcolor= "#e0e0e0" >
<?php
Include (' locationfilename.php ');
function Createur1 ($text) {
The news text file in this way inserts your link
${http://mysite.ch}
or ${http://mysite.ch|my homepage in}
Start working with the text file section
$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);
}
else{
$linktext = $a;
}
$s = $s. " <a href= "". $a. "" > ". $linktext." </a> ". $b;
}
}
return ($s);
}
Here to modify your news file storage directory
Remember, the news file must be a text file
$newspath = "/home/htdocs/test/new/";
Set array
$newsfile =array ();
Set up table of contents handles
$HD =dir ($newspath);
Get all the files and store them in an array
while ($filename = $hd->read ()) {
$s =strtolower ($filename);
if (Strstr ($s, ". txt")) {
Detect Latest Modified Date
$lastchanged =filemtime ($newspath. $filename);
$newsfile [$filename]= $lastchanged;
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.