现在大多网站都有幻灯片效果,有一个好看的幻灯片,能给网站添色不少。

不管JS、还是Jquery,添加到zblog上都要自己动手了,CSS样式自已去修改成你想要的!

自己整理了个代码,记录下来方便以后使用。

zblog调用幻灯片代码

代码如下:

<ul class="slider-relative" id="relative">{php}
    $array = explode(',',$zbp->Config('sml_cms')->indexflash);{/php}{foreach $array as $hotid}
    {$related=GetPost((int)$hotid)}
    <li class="slide fix-width"><a href="{$related.Url}" target="_blank"> 
    <img src="{php}$temp=mt_rand(1,5);$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";$content = $related->Content;
preg_match_all($pattern,$content,$matchContent);
if(isset($matchContent[1][0]))$temp=$matchContent[1][0];
else$temp="$host/zb_users/theme/$theme/style/images/random/$temp.jpg";                                  
{/php}{$temp}" alt="{$related.Title}" />
</a> 
<span class="text ani-left">
<strong><a href="{$related.Url}" target="_blank">{$related.Title}</a></strong>
<small><a href="{$related.Url}" target="_blank">{php}$intro= preg_replace('/[\r\n]+/', '', trim(SubStrUTF8(TransferHTML($related->Content,'[nohtml]'),30)).'...');{/php}{$intro}</a>
</small></span></li>
{/foreach}</ul>