荆姐 發表於 2023-12-6 00:00:00

DEDE在图集列表中调出图集的所有图片

<span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在include/common.func.php 中添加以下函数代码 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode18" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        // 在图集列表中调出图集的所有<u>图片</u> <br>
        function Getimgs($aid, $imgwith = 220, $imgheight = 80, $num = 0, $style = ''){ <br>
        global $dsql; <br>
        $imgurls = ''; <br>
        $row = $dsql -&gt; getone("Select * From`dede_addonimages` where aid='$aid'"); // <br>
        $imgurls = $row['imgurls']; <br>
        preg_match_all("/{dede:img (.*)}(.*){\/dede:img/isU", $imgurls, $wordcount); <br>
        $count = count($wordcount); <br>
        if ($num &gt; $count || $num == 0){ <br>
        $num = $count; <br>
        } <br>
        for($i = 0;$i &lt; $num;$i++){ <br>
        if($style == 'li'){ <br>
        $imglist .= "&lt;li&gt;&lt;a href=#" . $i . "&gt;&lt;imgsrc=". trim($wordcount[$i]) . " width=" . $imgwith . " height=" . $imgheight . "&gt;&lt;/a&gt;&lt;/li&gt;"; <br>
        }else{ <br>
        $imglist .= "&lt;li&gt;&lt;img class='lazy' src='../images/grey.gif' data-original=". trim($wordcount[$i])." width=" . $imgwith . " height=" . $imgheight . "&gt;&lt;/li&gt;"; <br>
        //此处用到了jquery的loadlazy延时加载插件。 <br>
        } <br>
        } <br>
        return $imglist; <br>
        } </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>模板中  </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>说明: 第一个参数 当前ID 第二个第三个, 图片尺寸。 第四个图片张数。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>也可以这样用 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode19" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        {dede:arclist row='3'} // row=3 调用三个图集 <br>
        //每个图集调用前4张 <br>
        {/dede:arclist} </div>
頁: [1]
查看完整版本: DEDE在图集列表中调出图集的所有图片