DEDECMS homepage calls multiple pictures in the picture collection, dedecms picture collection_PHP tutorial

WBOY
Release: 2016-07-13 09:51:45
Original
910 people have browsed it

DEDECMS home page calls multiple pictures in the picture collection, dedecms picture collection

First find the include/common.inc.php file and paste the following code into it (I posted the On my website, the details can be modified as needed):

function Getimg($aid,$imgwith,$imgheight)
{
global $dsql;
$imgurls = '';
$row =$dsql->getone( "select imgurls from dede_addonimages where aid='$aid' ");
$imgurls= $row['imgurls'];//获取字段数据
preg_match_all("/\}.+jpg/",$imgurls,$matches);//取出符合条件的
$new_arr=array_unique($matches[0]);//去除数组中重复的值
$pic_num1=" <dt><DIV class=tu_big><img id=imgInit class=zoom name=imgInit src=\"".substr($new_arr[0],2)."\" /></DIV></dt><dd><ul>";
foreach($new_arr as $key){
$pic_list.="<li><img onmouseover='pic_next(\"".substr($key,2)."\")' src=\"".substr($key,2)."\"' width=".$imgwith." height=".$imgheight." /></li>";
}
$pic_end="</ul></dd>";
return $pic_num1.$pic_list.$pic_end;//返回结果
}

Copy after login

1. Calling method on dedecms website homepage and list page:

dede:arclist tag call and dede:list list call

[field:id function="Getimg(@me,80,80,7)" /]
Copy after login

80, 80 and 7 are respectively the width (omitted to be 110) and height (omitted to be 110) and the number of images to be displayed (omitted to be (0), indicating all images).
If there are multiple photo albums, add the category id of the photo album, as follows

[field:id typeid='' function="Getimg(@me,80,80,7)" /]
Copy after login

2. How to call multiple pictures in the picture collection within the dedecms article:

{dede:field.id function="Getimg(@me,80,80,7)" /}
Copy after login

If there are multiple photo albums, add the category id of the photo album, as follows

{dede:field.id typeid='' function="Getimg(@me,80,80,7)" /}
Copy after login

80, 80 and 7 are respectively the width (omitted to be 110) and height (omitted to be 110) and the number of images to be displayed (omitted to be (0), indicating all images).

The above is the entire content of this article. I hope it will be helpful to everyone to master dedecms.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1011945.htmlTechArticleDEDECMS homepage calls multiple pictures in the picture collection. In the dedecms picture collection, first find the include/common.inc.php file , paste the following code in (I posted it from my website, the details can be customized as needed...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template