首页 未命名内容详情

zblog直接输入文章ID调用幻灯片的方法

2026-01-10 3 897698882
zblog直接输入文章ID调用幻灯片的方法

站点名称:zblog直接输入文章ID调用幻灯片的方法

所属分类:未命名

官方网址:

SEO查询: 爱站网 站长工具

进入网站

站点介绍

直接输入要调用的文章ID,直接调取文章内的图片为幻灯片,这种方式用的越来越多,懒人模式嘛,很多人没有太多精力经常去做图,所以直接输入文章ID是最为省心的方法了。

下面分享下直接输入文章ID调用幻灯片的方法:

{php} $hdpid = explode(',',$zbp->Config('ydimg')->ydimg_hdpid); foreach($hdpid as $id){ $post=GetPost((int)$id);    $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";            $content = $post->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/wutu.png";   {/php}   <li><a href="{$post.Url}"><img src="{$temp}" alt="{$post.Title}" /></a>   </li>   {php} } {/php}

第一行的:$zbp->Config('ydimg')->ydimg_hdpid  需要在主题配置内写入。

使用方法为连续输入文章ID,多ID用英文小逗号隔开。

其实这种调用方法非常简单,可以说太简单了,直接用下面这段也是可以的:

{php}$array = explode(',',$zbp->Config('ydit')->ydit_hdpid);{/php}{foreach $array as $key=>$id}{$post=GetPost((int)$id);} <li><a href="{$post.Url}" title="{$post.Title}" target="_blank">{$post.Title}</a></li>{/foreach}

调用指定文章。