Home > CMS Tutorial > DEDECMS > How to call the first picture of the article content on the DEDE list page

How to call the first picture of the article content on the DEDE list page

藏色散人
Release: 2020-01-04 09:14:25
Original
2783 people have browsed it

How to call the first picture of the article content on the DEDE list page

How to call the first image of the article content on the DEDE list page?

DEDE list page calls the first picture (non-thumbnail) method of the article content

Recommended learning: Dream Weaver cms

Open ../ include/ common.func.php

Add code

//将缩放图转变为文章第一张图片 
function firstimg($str_pic) 
{ 
$str_sub=substr($str_pic,0,-7).".jpg";//删除缩略图字符串最后七位,然后再补上后缀.jpg 
return $str_sub; 
}
Copy after login

The calling method is:

[field:litpic function='firstimg(@me)'/]
Copy after login

The above is the detailed content of How to call the first picture of the article content on the DEDE list page. For more information, please follow other related articles on the PHP Chinese website!

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