Home > CMS Tutorial > DEDECMS > body text

How does dedecms publish photo albums?

王林
Release: 2021-03-12 11:09:31
forward
2340 people have browsed it

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;
        }  
    }
Copy after login

4. Call

 {dede:arclist row=4 typeid =13}
  [field:id function=Getimgurls(@me,4)/]
 {/dede:arclist}
Copy after login

the latter
# on the web page ##

{dede:list pagesize=&#39;10&#39;}
    [field:id function=Getimgurls(@me,4)/]
{/dede:list}
Copy after login
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!

Related labels:
source:csdn.net
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