Home > Article > CMS Tutorial > How does dedecms publish photo albums?
dedecms’ specific method of publishing an atlas is as follows:
1. Create an image category in the background
2. Create an article, each Upload an image to the article
3. Add the following code to the /include/extend.func.php file
function Getimgurls($aid,$num=4) { global $dsql; $imgurls = $result = ''; $imgrow = $dsql->GetOne( "Select imgurls From `dede_addonimages` where aid='$aid' "); $imgurls = $imgrow['imgurls']; if($imgurls != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($imgurls); $images = array(); if(is_array($dtp->CTags)) { foreach($dtp->CTags as $ctag) { if($ctag->GetName() == 'img') { $row = array(); $row['width'] = $ctag->GetAtt('width'); $row['height'] = $ctag->GetAtt('height'); $row['imgsrc'] = trim($ctag->GetInnerText()); $row['text'] = $ctag->GetAtt('text'); $images[] = $row; } } } $dtp->Clear(); $i = 0; foreach($images as $row) { if($i == $num) break; if($row['imgsrc'] != '') { $result .= "<li><img src='{$row['imgsrc']}' alt='{$row['text']}' width='70' height='70'></li>"; } $i++; } return $result; } }
4. Call
{dede:arclist row=4 typeid =13} [field:id function=Getimgurls(@me,4)/] {/dede:arclist}
the latter
# on the web page ##
{dede:list pagesize='10'} [field:id function=Getimgurls(@me,4)/] {/dede:list}Related recommendations:
The above is the detailed content of How does dedecms publish photo albums?. For more information, please follow other related articles on the PHP Chinese website!