 <h3 style="border-bottom:1px solid #ccc;margin-bottom:10px;padding:5px">分类标识</h3>

<?php
 $sqlmain = "SELECT * from ".TABLE_CATE." where  pid='0' and modtype='node' $andlangbh order by pos desc,id";
 $rowlistmain = getall($sqlmain);
 if($rowlistmain=='no') {
  echo '<p>&nbsp;&nbsp;还没有分类，请添加...</p>';
  }
  else{

  echo '<ul class="seolist ">';
   foreach($rowlistmain as $vmain){
        $pidnamemain=$vmain['pidname'];
        $namemain='<strong>'.decode($vmain['name']).'</strong>';


        echo '<li>';
        echo '<div style="padding:3px;background:#e2e2e2"><h3>'.$namemain.' - <span class="cgray">'.$pidnamemain.' </span></h3></div>';

 $sqlsub = "SELECT * from ".TABLE_CATE." where  pid='$pidnamemain' $andlangbh order by pos desc,id";
 $rowlistsub = getall($sqlsub);
 if($rowlistsub=='no') {
  echo '<p>&nbsp;&nbsp;还没有子分类，请添加...</p>';
  }
  else{
  ?>

 <?php
 echo '<ul class="seolist seolistcate">';
   foreach($rowlistsub as $vsub){

       $pidname=$vsub['pidname'];
       $name='<strong>'.decode($vsub['name']).'</strong>';


       echo '<li style="padding:3px  0px 3px 25px">';
        echo '<h3><i class="fa fa-caret-right" aria-hidden="true"></i> '.$name .' - <span class="cgray">'.$pidname.' </span></h3>';


//----if sub sub cat------------------------
         $sqlsub_sub = "SELECT  *  from ".TABLE_CATE." where  pid='$pidname' $andlangbh order by pos desc,id";
         $row_sub = getall($sqlsub_sub);

      //----if sub sub cat------------------------
         if($row_sub<>'no'){
           echo '<ul>';
              foreach($row_sub as $v2_sub){
           $nameSub=decode($v2_sub['name']);
           $subpidname=$v2_sub['pidname'];

          echo '<li style="padding:3px  0px 3px 25px">';
          echo '<h3><i class="fa fa-caret-right" aria-hidden="true"></i>  '.$nameSub.' - <span class="cgray">'.$subpidname.' </span></h3>';
          echo '</li>';

        }
         echo '</ul>';

  }
  echo '</li>';
  }
  echo '</ul>';
}
//--------------
echo '</li>';
}
echo '</ul>';
}

?>

 