Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to get multiple pictures from a set of pictures by dedecms

Shulou Source: shulou.com Published: 2022-06-02 03:34:16 10月02日 Update

This article mainly introduces dedecms how to obtain multiple pictures of the picture collection, the article is very detailed, has a certain reference value, interested friends must read it!

How does dedecms get multiple pictures from a collection of pictures?

The realization method of obtaining multiple pictures from a picture set by dedecms (circular output)

Each case requires a lot of pictures and is displayed with a certain effect. The effect of the retrieval method that comes with weaving dreams is to call multiple parameters at once, and the effect shown is not what I need. The following is the method of searching from Baidu. You can refer to it.

When making a website for customers, the effect you need to do is to have a lot of pictures in each case, and show it with a certain effect. However, I found that the effect of the retrieval method of weaving dream itself was to call multiple parameters at once, and the effect was not what I needed, and it was very tangled at that time. Later, I thought about it by myself, but unfortunately I didn't succeed. Finally, the realization method is found through the network Baidu search.

There are two steps to implement the method:

1. Add the method / / to / include/common.func.php to output multiple images function.

The code is as follows:

Function Getimgs ($aid, $imgwith = 300,270, $num = 0, $style =') {global $dsql; $imgurls =''; $row = $dsql-> getone ("Select imgurls from `dede _ addonimages` where aid='$aid'"); / / $imgurls = $row ['imgurls']; preg_match_all ("/ {dede:img (. *)} (. *) {\ / dede:img/isU", $imgurls, $wordcount); $count = count ($wordcount [2]); if ($num > $count | | $num = = 0) {$num = $count } for ($I = 0x / s)

< $num;$i++){ if($style == 'li'){ $imglist .= ""; }else{ $imglist .= "

";}} return $imglist;}

2. Call the method {dede:field.id function= "Getimgs (@ me,400,400,10)" /} in the template

The above is how dedecms gets all the contents of multiple pictures in the picture collection. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Pictures methods effects multiple picture sets one-time content parameters multiple case reference loop search output success two code value interest customer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL Docker Microsoft Huawei