Home  >  Article  >  Backend Development  >  PHP贴

PHP贴

WBOY
WBOYOriginal
2016-06-13 11:56:341245browse

PHP求助贴!
phtml页面的 :
rows1 as $row1){?>
                      


                             

                             

                                     rows2 as $row2){if($row1["id"]==$row2["parent_id"]){?>
                                        

  •                                        " name="check_box[]" class="check_box">  
                                        

  •                                  
                                 

                      
 
                      

controller页面:
//一级分类列表
$modelcategory = new App_Model_Category();
$this->view->rows1 = $modelcategory->getTopcategory();
//获取所有分类
$this->view->rows2 = $modelcategory->getAllcategory();


这是一个二级分类的,现在我想让没有二级分类的一级分类模块都隐藏,该怎么实现。。。求解决
------解决方案--------------------
都不知道你想干什么。。。。
先把你具体要做什么讲清楚,你的代码现在是什么状况。
------解决方案--------------------
循环所有分类   给所有有二级分类的模块加一标志  像这样

foreach(所有分类){
         if(当前分类有二级分类){
               所有分类[flag] = 1;
        } else{
            所有分类[flag] = 0
      } 
}
之后在模板中循环时判断有没有标志
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