Home  >  Article  >  Backend Development  >  The typecho home page loops through all categories, and then outputs one (img) picture for each category.

The typecho home page loops through all categories, and then outputs one (img) picture for each category.

WBOY
WBOYOriginal
2016-09-08 08:43:531385browse

**I want to make a cms type website
The home page loops to output all categories [output 6 articles under each category]
Then each category outputs a unique (img) picture in the folder [such as loading books in one category "fl1 .png" the second category "fl2.png" and so on]**

Hope everyone can answer! ! I wish everyone a happy Mid-Autumn Festival in advance (✪▽✪)! !

The typecho home page loops through all categories, and then outputs one (img) picture for each category.

Reply content:

**I want to make a cms type website
The home page loops to output all categories [output 6 articles under each category]
Then each category outputs a unique (img) picture in the folder [such as loading books in one category "fl1 .png" the second category "fl2.png" and so on]**

Hope everyone can answer! ! I wish everyone a happy Mid-Autumn Festival in advance (✪▽✪)! !

The typecho home page loops through all categories, and then outputs one (img) picture for each category.

<code>$obj = $this->widget('Widget_Metas_Category_List');
if($obj->have()){
    while($obj->next()){
        echo '<strong>'.$obj->name.'</strong>';
        echo '<ul>';
        $this->widget('Widget_Archive@'.$obj->name, 'type=category', 'mid='.$obj->mid)->to($categoryPosts);
        while ($categoryPosts->next()) {
            echo '<li>'.$categoryPosts->title.'</li>';
        }
        echo '</ul>';

    }
}else{
    echo '无分类';
}</code>

I don’t understand the classified pictures

Statement:
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