07
2020
01

zblog调用幻灯片代码

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

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

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

代码如下:

<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>

原文链接:https://www.qiquanji.com/post/8688.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。