活动按钮错误

jljoyd4f  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(198)

你好吗?我修改的程序有问题。是一个系列的网站,我几乎解决了一切,我到了一个点,是很难确定的问题。
在要显示的系列页面中,会显示季节,也会显示剧集。
每一季第一集的按钮都会高亮显示,就好像它们正在被观看一样,当我点击一集时,每个人都会被取消标记,而我点击的内容也会被激活。我只想保持活跃的是第一季的第一集,这是什么正在屏幕上显示和其他第一集关闭。
问题出现在以下行中:

<?php 
    if($episode['stream_key']==$current_key){ 
        echo 'btn-success';
    } else {
        if($current_key=='000000' && $i=='1'){ 
            echo 'btn-success';
        }else{ 
            echo 'btn-default';
        }
    }
?>

下面一行是为了理解上下文:

<div class="row">

    <div class="col-md-12  m-t-10 m-b-10">

        <?php
            $this->db->order_by('seasons_id', "ASC");
            $seasons = $this->db->get_where('seasons',array('videos_id'=>$watch_videos->videos_id))->result_array();
            foreach ($seasons as $season):                                       

         ?>
         <?php if($this->common_model->get_num_episodes_by_seasons_id($season['seasons_id']) > 0): ?>

        <div class="season">                                        

            <p class="btn btn-inline text-uppercase" style="font-size: 12px;color: #055b86">TEMP: <?php echo $season['seasons_name']; ?> | EP: </p>

                <?php

                    $this->db->group_by('seasons_id');
                    $this->db->order_by('seasons_id', "ASC");
                    $this->db->group_by('episodes_id');
                    $this->db->order_by('episodes_id', "ASC");
                    $episodes = $this->db->get_where('episodes',array('videos_id'=>$watch_videos->videos_id,'seasons_id'=> $season['seasons_id']))->result_array();

                    $i=0;

                    $current_key = '000000';

                    if(isset($_GET['key']))
                        $current_key = $_GET['key'];
                        foreach($episodes as $episode):
                            $i++;

                 ?>

                <a href="<?php echo base_url().'watch/'.$watch_videos->slug.'.html?key='.$episode['stream_key']; ?>" class="btn btn-sm btn-inline <?php if($episode['stream_key']==$current_key){ echo 'btn-success';}else {} ?>" style="font-size: 10px; margin-bottom:5px !important;"><?php echo $episode['episodes_name']; ?></a>

                <?php endforeach; ?>                                        

            </div>

        <?php endif; ?>

    <?php endforeach; ?> 

    </div>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题