站点介绍
下面和大家分享一下,在制作zblog主题时,老鱼网常用的相关文章调用方法:
<ul> {if $article.Tags}{$array=GetList(6,null,null,null,$article->Tags,null,array('is_related'=>$article->ID));}{foreach $array as $related}<li><a href="{$related.Url}" target="_blank"><i> {if $related.Metas.thumburl} <img src="{$related.Metas.thumburl}" alt="{$related.Title}"> {else}<img src="{tt_thumb_pro_url($related,150,150)}" alt="{$related.Title}">{/if} </i><h3>{$related.Title}</h3><p> {php}$intro= preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($related->Intro,'[nohtml]'),80)).'...');{/php}{$intro}</p></a><a href="{$related.Category.Url}" class="ttname">{$related.Category.Name}</a><span>{$related.Time('Y-m-d')}</span></li> {/foreach} {else} {foreach GetList(6,$article.Category.ID) as $related}<li><a href="{$related.Url}" target="_blank"><i> {if $related.Metas.thumburl} <img src="{$related.Metas.thumburl}" alt="{$related.Title}"> {else}<img src="{tt_thumb_pro_url($related,150,150)}" alt="{$related.Title}">{/if} </i><h3>{$related.Title}</h3><p> {php}$intro= preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($related->Intro,'[nohtml]'),80)).'...');{/php}{$intro}</p></a><a href="{$related.Category.Url}" class="ttname">{$related.Category.Name}</a><span>{$related.Time('Y-m-d')}</span></li> {/foreach} {/if} </ul>上面代码说明:
如果文章内没有填写标签,就调用同分类下的最新文章,填写了标签就调用同标签的文章!
最后大家对应着改相关参数就可以了!