Home > 整站程序 > phpcms2007将频道首页设为网站首页的方法

phpcms2007将频道首页设为网站首页的方法

November 11th, 2007 Leave a comment Go to comments

本方法是利用copy函数将频道首页复制为网站首页,在更新频道首页时,同步更新网站首页,不必在更新首页。
本例是把文章频道的首页设为网站首页。
在module/article/include/createhtml/index.php第20行加入如下代码

$file = 'article/index.html';
$newfile = 'index.html';
if (!copy($file, $newfile)) {
  echo "failed to copy $file…\n";
}

在更新文章频道首页的时候,就把文章首页复制为网站首页,原来的被覆盖掉,换句话说,也就没有必要在更新首页。
如果你想把下载频道首页设为网站首页到相应目录把代码中的article换为down即可。
注意:本方法只适用于整个网站只有一个同类型频道

代码的安全性没有考虑,还有就是代码中的引号要注意,可能需要用单角重新输入。

Categories: 整站程序 Tags:
  1. No comments yet.
  1. No trackbacks yet.

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).