A few days ago, I built a website and found that although three pages for a question are the same except for different image sizes, if there are two pages, we all understand that one thumbnail image and one picture is hung in one content. This way, we can make two pictures of different image sizes quickly and smoothly, but what to do with the three, so we thought of custom fields.
Open the/include/extend.function.php file (Note: This file is a custom function interface file reserved by the system and is mainly used for secondary development. If you are an older version, you don't have this file by default, just create your own PHP file), at the bottom?> Add the following function code to the previous line
if($img <> ”){
$dtp = new DedeTagParse();
$dtp->LoadSource($img);
if(is_array($dtp->CTags)){
foreach($dtp->CTags as $ctag){
if($ctag->GetName()==’img’){
$width = $ctag->GetAtt(‘width’);
$height = $ctag->GetAtt(‘height’);
$imgurl = trim($ctag->GetInnerText());
$img = ”;
if($imgurl !=”){
if($ftype==1){
$img .= $imgurl;
}
else{
$img .=‘<img src=”‘.$ imgurl.”’width=”‘.$ width.”’height=”‘.$ height.”’/>’;
}
}
}
}
}
$dtp->Clear();
return $img;
}
}
<li>[field:title/][field:imgurl function=’GetOneImgUrl(@me,0)’/]</li>
{/dede:arclist}