Home >Backend Development >PHP Tutorial >分类输出论坛版块有关问题

分类输出论坛版块有关问题

WBOY
WBOYOriginal
2016-06-13 10:31:56852browse

分类输出论坛版块问题
用的是smarty模板,求大神给个思路,有代码最好,不用太详细也可以。谢谢!!!
想要实现的效果如下:

大版块1
------>小版块1
------>主题:324帖子:3242
------>最近发表:2012-6-28 12:00:00

大版块2
------>小版块1
------>主题:324帖子:3242
------>最近发表:2012-6-28 12:00:00

------>小版块2
------>主题:324帖子:3242
------>最近发表:2012-6-28 12:00:00

表结构如下:
------------------------
 id | name | parent_id | theme_count | reply_count | time |
------------------------
  1 | 版块1 | 0 | 123 | 123 | 2012-6-28 12:00:00 |
------------------------

假设smarty模板如下:

HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><p>大版块</p>
  • 小版块
  • 主题:324帖子:3242
  • 最近发表:2012-6-28 12:00:00


------解决方案--------------------
在php构建下面这样的数组
PHP code
$arr=array('大版块1'=>array(                0=>array('小版块1','324','3242','2012-6-28 12:00:00'),                1=>array('小版块2','324','3242','2012-6-28 12:00:00')               ),'大版块2'=>array(                0=>array('小版块1','324','3242','2012-6-28 12:00:00'),                1=>array('小版块2','324','3242','2012-6-28 12:00:00')               ))<div class="clear">
                 
              
              
        
            </div>
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