这两天改了一下网站首页。
1,在原来logo的旁边,加了两个女真文,这两个字的意思是ilan aniya,三年,anaku网站建立即将满3年。
2,做了几个首页上的logo,随机从其中取出一张图片显示。
代码
<?
$imd = opendir('./i/banner/');
while (false !== ($file = readdir($imd)))
{
list($filesname,$ext)=explode(".",$file);
if ($ext=="gif")
{
if (!is_dir('./i/banner/'.$file))
{
$wfile="./i/banner/".$file;
$img[]=$wfile;
}
}
}
$rnd=array_rand($img);
?>
<img src="<?=$array[$rnd]?>"/>
3,为避免首页内容总是一成不变,增加动态的推荐内容:从blog列表中选择加了标记的文章,添加到首页,最多显示5个,超过了只显示最新的5个。
代码
<?
$tmp= at file("Blog/msc_ar/list dot php");
$nona=count($tmp);
$n=0;
for ($i=0; $i<$nona;$i++) {
$latest=explode("&line;",$tmp[$i]);
$articleidd=$latest[1];
$latest[2]=stripslashes($latest[2]);
$articlename=$latest[2];
$sar=explode(" at ",$articlename);
$recommend=$sar[1];
$rest = substr($articlename, 0, 1);
if (strcmp($rest,"@")==0)
{
if($n<5)
echo'<a href="/Blog/index dot php?job=art& articleid='.$latest[1].'">' .$recommend.'</a> ';
else
break;
$n++;
}
}?>
©2005-2025 ANAKV