DEDECMS homepage calls multiple pictures in the picture collection_PHP tutorial

WBOY
Release: 2016-07-13 09:51:41
Original
833 people have browsed it

DEDECMS homepage calls multiple pictures in the picture collection

This article shares with you the method of calling multiple pictures in the picture collection on the homepage of the DreamWeaver system, which has the same needs. Friends can refer to it.

First find the include/common.inc.php file and paste the following code into it (I posted it from my website, you can modify it as needed):

 ?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

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

    ";

    foreach($new_arr as $key){

    $pic_list.="

  • ";

    }

    $pic_end="

";

return $pic_num1.$pic_list.$pic_end;//返回结果

}

1

2

3

4

1

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

5

6

7

1

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

8

9

10

1

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

11

12

1

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

13 14 15
function Getimg($aid,$imgwith,$imgheight) { global $dsql; $imgurls = ''; $row =$dsql->getone( "select imgurls from dede_addonimages where aid='$aid' "); $imgurls= $row['imgurls'];//Get field data preg_match_all("/}. jpg/",$imgurls,$matches);//Get the qualified $new_arr=array_unique($matches[0]);//Remove duplicate values ​​in the array $pic_num1="
    "; foreach($new_arr as $key){ $pic_list.="
  • "; } $pic_end="
"; return $pic_num1.$pic_list.$pic_end;//return result }
1. Calling method on dedecms website homepage and list page:  dede:arclist label call and dede:list list call  ?
1 [field:id function="Getimg(@me,80,80,7)" /]
80, 80 and 7 are respectively the width (omitted to be 110) and height (omitted to be 110) of the picture to be displayed and the number of pictures to be called (omitted to be (0), indicating all pictures). If there are multiple photo albums, then add the category id of the photo album, as follows  ?
1 [field:id typeid='' function="Getimg(@me,80,80,7)" /]
2. How to call multiple pictures in the picture collection within the dedecms article:  ?
1 {dede:field.id function="Getimg(@me,80,80,7)" /}
If there are multiple photo albums, then add the category id of the photo album, as follows  ?
1 {dede:field.id typeid='' function="Getimg(@me,80,80,7)" /}

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

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/1012362.htmlTechArticleMultiple pictures in the DEDECMS homepage call picture collection. This article shares with you the homepage call picture collection in the DreamWeaver system. Friends who have the same needs can refer to the method of multiple pictures...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!