Home  >  Article  >  CMS Tutorial  >  How does dedecms publish photo albums?

How does dedecms publish photo albums?

王林
王林forward
2021-03-12 11:09:312275browse

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=&#39;{$row[&#39;imgsrc&#39;]}&#39; alt=&#39;{$row[&#39;text&#39;]}&#39; width=&#39;70&#39; height=&#39;70&#39;></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=&#39;10&#39;}
    [field:id function=Getimgurls(@me,4)/]
{/dede:list}

Related recommendations:

梦伟cms

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete