效果图:

代码:

 

<main>

<?php
/******参数配置开始******/
$classid = "1,2";
/******参数配置结束******/
$tabid = 1;
$classidObj=$empire->query("select classname,classid,sonclass,classpath from {$dbtbpre}enewsclass where classid in($classid) order by myorder,classid");
while($r=$empire->fetch($classidObj)){
$checked = $tabid==1?"checked":'';
$tab_list.= '<input id="tab'.$tabid.'" type="radio" name="tabs" '.$checked.'><label for="tab'.$tabid.'">'.$r[classname].'</label>';
$newObj = $empire->query("select * from {$dbtbpre}ecms_news where classid=$r[classid]  order by `newstime` desc");
while($r2=$empire->fetch($newObj)){
$list.='<div class="index_bg3">
        <div class="index_a index_bg3s">
        <a href="'.$r2[downurl].'" class="la1 a1" target="_blank"><img src="/skin/zhann/images/btn_details.png" width="60%" height="60%"></a>
    </div>
    <div class="index_a index_bg2s">
   <p id="text1">'.$r2[downurl].'</p>

        <img class="la1 a1 js-copy" src="/skin/zhann/images/btn_copy.png" width="60%" height="60%">
    </div>
    <img src="'.$r2[titlepic].'">
</div>';
}
$session_list.='<section id="content'.$tabid.'">'.$list.'</section>'; 
$list='';
$tabid++;
}
?>


<?=$tab_list?>
<?=$session_list?>
    

	
	  <script type="text/javascript">
 $('.js-copy').click(function(){
   let This = $(this);
     let text = This.siblings('p').text();
     var input = document.getElementById("input");
     input.value = text; // 修改文本框的内容
      input.select(); // 选中文本
      document.execCommand("copy"); // 执行浏览器复制命令
     console.log(text)
      alert("复制成功");
})

  </script>
</main>

留空则显示全部分类

<main>

<?php
/******参数配置开始******/
//参数留空则调用全部
$classid = "";
/******参数配置结束******/
if(empty($classid)){
	$where = "islast = 1";
}else{

$where = "classid in($classid)";
}



$tabid = 1;
$classidObj=$empire->query("select classname,classid,sonclass,classpath from {$dbtbpre}enewsclass where $where order by myorder,classid");
while($r=$empire->fetch($classidObj)){
$checked = $tabid==1?"checked":'';
$tab_list.= '<input id="tab'.$tabid.'" type="radio" name="tabs" '.$checked.'><label for="tab'.$tabid.'">'.$r[classname].'</label>';
$newObj = $empire->query("select * from {$dbtbpre}ecms_news where classid=$r[classid]  order by `newstime` desc");
while($r2=$empire->fetch($newObj)){
$list.='<div class="index_bg3">
        <div class="index_a index_bg3s">
        <a href="'.$r2[downurl].'" class="la1 a1" target="_blank"><img src="/skin/zhann/images/btn_details.png" width="60%" height="60%"></a>
    </div>
    <div class="index_a index_bg2s">
   <p id="text1">'.$r2[downurl].'</p>

        <img class="la1 a1 js-copy" src="/skin/zhann/images/btn_copy.png" width="60%" height="60%">
    </div>
    <img src="'.$r2[titlepic].'">
</div>';
}
$session_list.='<section id="content'.$tabid.'">'.$list.'</section>'; 
$list='';
$tabid++;
}
?>


<?=$tab_list?>
<?=$session_list?>
    

	
	  <script type="text/javascript">
 $('.js-copy').click(function(){
   let This = $(this);
     let text = This.siblings('p').text();
     var input = document.getElementById("input");
     input.value = text; // 修改文本框的内容
      input.select(); // 选中文本
      document.execCommand("copy"); // 执行浏览器复制命令
     console.log(text)
      alert("复制成功");
})

  </script>
</main>

演示地址:

http://yxx.cncobo.com/
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。