其实这已经有人发表过了,我就借鉴整理完整一些吧,希望能够帮到更多网友!
zblogphp本身系统模块中只有最新发表文章的模块,但是一般博客中都会有热门文章和随机文章模块;
接下来,我们就增加系统模块:
首先将zb_system\function\c_system_event.php 文件下载下来
用专门的编译器来编辑(不要用文本编辑)
打开查找 $zbp->AddBuildModule('previous'); 在后面添加
$zbp->AddBuildModule('hotarticles');
$zbp->AddBuildModule('sjarticles');
再次点击查找,继续查找 $zbp->AddBuildModule('previous'); 在后面添加
$zbp->AddBuildModule('hotarticles');
$zbp->AddBuildModule('sjarticles');
在c_system_event.php 该文件最后面增加然后
//热门文章 ,按照文章浏览量排序function BuildModule_hotarticles(){ global $zbp; $i = $zbp->modulesbyfilename['hotarticles']->MaxLi; if ($i == 0) $i = 10; $articles = $zbp->GetArticleList('*', array(array('=', 'log_Type', 0), array('=', 'log_Status', 0)), array('log_ViewNums' => 'DESC'), $i, null,false); $s = ''; foreach ($articles as $article) { $s .= '<li><a href="' . $article->Url . '">' . $article->Title . '</a></li>'; } return $s;}//随机文章function BuildModule_sjarticles(){ global $zbp; $i = $zbp->modulesbyfilename['sjarticles']->MaxLi; if ($i == 0) $i = 10; $articles = $zbp->GetArticleList('*', array(array('=', 'log_Type', 0), array('=', 'log_Status', 0)),array('rand()'=>' '), $i, null,false); $s=''; foreach ($articles as $article) { $s .= '<li><a href="' . $article->Url . '" title="' . $article->Title . '">' . $article->Title . '</a></li>'; } return $s;}接下来下载 zb_system\function\lib\zblogphp.php 文件,打开编辑
查找 $this->RegBuildModule('previous','BuildModule_previous'); 在后面添加
$this->RegBuildModule('hotarticles','BuildModule_hotarticles');
$this->RegBuildModule('sjarticles','BuildModule_sjarticles');
以上两个文件编辑完成后,保存并上传到相应目录覆盖原文件;
在顾陌博客中,是说需要到数据库中增加数据,但是那个我测试后,发现不行,因为zblog php的module表内有 mod_Meta表栏,但是我们却不需要去填写它,可是不填写保存的时候又会出错显示 Parse error: syntax error, unexpected;
所以就不按照这么做了,解决方法:
如果你要你增加的模块是系统模块,那么可以这么做,先在网站后台-模块管理,增加模块
热门文章 随机文章
hotarticles sjarticles
divhotarticles divsjarticles
选择 ul 选择 ul
然后登入数据库,在module表中在以上两个数据的 mod_Source 中的user改成system就行了!这是不是简单多了!!!
最后就是调用了,在相应模块中的内容编辑
{$modules['hotarticles'].Content}获取热门文章列表,
{$modules['sjarticles'].Content}获取随机文章列表。
看本网站就成功了哦。。。。。




