在显示新闻的地方放入代码:
〈
?php
require"./shownews.php";
?〉
第二部分为新闻的发布,由
pupnews.php 脚本实现,代码如下:
〈
?php
if($id=="")
{
Header("Location:./shownews.php");
}
?〉
〈
html〉
〈
head〉
〈
metacontent="chenqiang"name=Author〉
〈
?php
$filename="./news/".$id.".txt";
$fa=file($filename);
$n=count($fa);
$s=trim($fa[0]);
$s=htmlspecialchars($s);
$t="-newsbywaterwall";
print"〈title〉".$s.$t."〈/title〉n";
?〉
〈
/head〉
〈
body〉
〈
?php
//输出文本标题
print"〈blockquote〉n";
print"〈b〉〈center〉".$s."n";
print"〈/center〉〈/b〉
〈
p〉n";
//输出文本正文
for($i=1;$i〈$n;$i =1)
{
$s=chop($fa[$i]);
$s=htmlspecialchars($s);
$s=trim($s);
print"".$s."
n";
}
print"〈/p〉〈/blockquote〉n";
?〉