您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

thinkphp无限分类应用,仿织梦栏目管理

2025/11/21 21:10:24发布34次查看
最近官网上关于无限分类的分享很多,大象也来分享一下我的无限分类,是看了织梦的栏目管理后得写出来的,优点是管理方便,多层级,为此我还写了jquery进行关闭展开分类,缺点是不可重用,希望高手们能给出见解,变成一个可重用的,不过我觉得栏目管理这东西,一个站最多一个,所以重用意义也不大。大象qq:576272452
织梦的栏目管理非常帅,多级栏目显示上面非常清晰,今天大象仿了个织梦的多级栏目管理,废话不多说,上代码
1、递归类 typeunit.calss.php
class typeunit {
    /**
     *  读出所有分类,在类目管理页(list_type)中使用
     *
     * @access    public
     * @param     int   $table  表名
     * @param     int   $topid  当前操作id
     * @return    string
     */
     public function listtype($table='keshi',$topid=0){
        $form = m($table);
        $list = $form->where('topid='.$topid)->order(sort desc,id asc)->select();
        foreach ($list as $k => $v) {
             echo 'id '.$v['id'].' '.$v['name'].' 操作
';
             $this->listtypeseed($table,$v['id']);
         } 
    }
/**
     *  读出子分类
     *
     * @access    public
     * @param     int   $table  表名
     * @param     int   $topid  当前操作id
     * @return    string
     */
    private function listtypeseed($table,$topid){
        $form = m($table);
        $list = $form->where('topid='.$topid)->order(sort desc,id asc)->select();
        if($list){
            echo '';
            foreach ($list as $k => $v) {
                 echo 'id '.$v['id'].' '.$v['name'].' 操作
';
                 $this->listtypeseed(keshi,$v['id']);
             }
            echo '
';
        }
    }
}
?>2、模板页面 index.html
$tu = new typeunit();
    $tu->listtype('keshi',0);
ad:真正免费,域名+虚机+企业邮箱=0元
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product