一些计数后需要显示更多按钮

时间:2014-02-15 07:13:35

标签: php yii

if(count($fetchExperiences) > 0)
    {

        $i=0;
        foreach($fetchExperiences as $fetchExperience)
        {
           $sqlExperiencedat  = $db->createCommand(" code ");
        $fetchExperiencesdat  = $sqlExperiencedat->queryAll();
        $tdyyy=date('YYYY-mm-dd');
            if(strtotime($tdyyy)<strtotime($fetchExperience['experience_date']))
            {
        foreach($fetchExperiencesdat as $fetchExperiencesdatt)
         {
        if(strtotime($tdyyy)<strtotime($fetchExperiencesdatt['avail_date']))
        {

            //echo $fetchExperiencesdatt['avail_date'];
            $tth=1;
        }
         }
            if($tth==1){
              //fetchExperiencesdatt code
             }
         }
       }
       if(count($fetchCountExperiences) > 8){ 
       <a class="more_experience" style="clear:both;"><span onclick="getMoreExperiences1('<?            php echo count($userResults);?>','<?php echo $_SESSION['user_id']; ?>','8')">More Experiences</span></a>
       }

    }
}

我的问题是,在$fetchexperiences计数大于8之后我想要更多按钮。没关系。但是在$fetchexperiences循环之间有$fetchExperiencesdat的循环。如果在availdate中没有经验,则循环显示它。所以问题是更多按钮显示不是在8之后因为一些$fetchExperiencesdat元素应该被隐藏。所以请给我任何解决方案。

感谢你。

1 个答案:

答案 0 :(得分:0)

我不确定我是否了解您的点票经历来自哪里。但是,您的代码存在的问题是fetchCountExperiences没有给出值。

   if(count($fetchCountExperiences) > 8){ 
   <a class="more_experience" style="clear:both;"><span onclick="getMoreExperiences1('<?            php echo count($userResults);?>','<?php echo $_SESSION['user_id']; ?>','8')">More Experiences</span></a>
   }

看起来应该是

   if(count($fetchExperiences) > 8){ 
   <a class="more_experience" style="clear:both;"><span onclick="getMoreExperiences1('<?            php echo count($userResults);?>','<?php echo $_SESSION['user_id']; ?>','8')">More Experiences</span></a>
   }