你好吗?我正在修改的程序有问题。 是一个系列网站,我几乎设法解决了我所遇到的所有其他问题,而这一点很难确定问题所在。
在要显示的系列页面中,季节出现,情节也出现。
每个季节的第一集的按钮都会高亮显示,就像正在观看一样,当我单击一个集时,每个人都没有标记,并且我单击的内容变为活动状态。 我希望唯一保持活跃的是第一季的第一集,这是屏幕上显示的内容,其他第一集都被关闭了。
问题出在以下几行:
<?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>