zblog文章页调用同分类文章需要用到getlist函数,居然代码如下
{php} $cid=$article->Category->RootID?$article->Category->RootID:$article->Category->ID; //获取当前大分类ID $posttime=$article->PostTime; $weektime=$posttime-604800; $w=array(); $w['random']=9; //随机9篇文章 $w['count']=9; //读取9篇文章 $w['cate']=$cid; //当前分类或当前大分类 $w['has_subcate']=1; //指定包含子孙目录 $w['where_custom']=array(array('>', 'log_PostTime', $weektime),array('<', 'log_PostTime', $posttime)); //当前文章发布时间一周内的文章 $array=GetList($w); {/php} {foreach $array as $key=>$related} <li><a href="{$related.Url}" target="_blank"><i>{$key+1}</i> {$related.Title} </a></li> {/foreach}