<fh-function>
$keyword=t($_REQUEST["keyword"]);
$page=$_GET["page"];
$tag=t($_GET["tag"]);
$orderby=$_GET["orderby"];
$part=$_GET["part"];

switch($part){
  case "all":
  case " ":
    $pa="";
  break;
  case "free":
    $pa=" and P_price=0 ";
  break;
  case "pay":
    $pa=" and P_price>0 ";
  break;
  case "vip":
    $pa=" and P_vip=1 ";
  break;
}

switch($orderby){
  case "normal":
  case "":
    $order=" order by P_top desc,P_order asc,P_id desc";
  break;
  case "hot":
    $order=" order by P_view desc";
  break;
  case "time":
    $order=" order by P_id desc";
  break;
  case "rand":
    $order=" order by rand()";
  break;
}

$url=gethttp().$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
function url($url,$key,$value){
  $url=str_replace("&".$key."=".str_replace("%3A",":",urlencode($value)),"",$url);
  return $url;
}

if($tag==""){
  $taginfo="";
}else{
  $taginfo=" and CONCAT(\" \",P_tag,\" \") like '% ".$tag." %'";
}

$M_id=intval($_GET["M_id"]);
if($page==""){
  $page=1;
}
if($M_id!=0){
  $M_info=" and P_mid=$M_id ".$taginfo;
}else{
  $M_info=" and P_sh=1".$taginfo;
}

$sql="select * from sl_psort where S_id=".$id;
  $result = mysqli_query($conn, $sql);
  $row = mysqli_fetch_assoc($result);
  if (mysqli_num_rows($result) > 0) {
    $S_sub=$row["S_sub"];
  }


  if($id==0){
    $sql="select count(P_id) as P_count from sl_product where P_del=0 ".$pa.$M_pinfo."  ".shuxing("P_shuxing")." $M_info order by P_order,P_id desc";
  }else{
    if($S_sub==0){
      $sql="select count(P_id) as P_count from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_sub=".$id." order by P_order,P_id desc";
    }else{
      $sql="select count(P_id) as P_count from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_id=".$id." order by P_order,P_id desc";
    }
  }

$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$P_count=$row["P_count"];

$page_num=intval($P_count/10)+1;
if($P_count%10 ==0){
  $page_num=$page_num-1;
}

function is_haves($a,$b){
  if(in_array($a,$b)){
      return true;
  }else{
      return false;
  }
}

</fh-function>
<!DOCTYPE HTML>
<html><head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-title" content="Modown">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <title>[S_title] - [fh_title]</title>
    <link href="media/[fh_ico]" rel="shortcut icon" />
    <meta name="description" content="[S_content]" />
    <meta name="keywords" content="[S_keywords]" />
    <link rel="stylesheet" href="template/t16/assets/web/styles/libs.css?1638004846">
    <link rel="stylesheet" href="template/t16/assets/web/styles/style.css?1638004846">
    <link rel="stylesheet" href="template/t16/assets/web/fonts/css/fontawesome-all.min.css">
    <link rel="stylesheet" href="template/t16/assets/styles/swiper.min.css">
    <link href="css/Pager.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="template/t16/assets/scripts/jquery.min.js"></script>
    <script type="text/javascript" src="template/t16/assets/scripts/swiper.min.js"></script>
    <script type="text/javascript" src="template/t16/assets/scripts/layer.js"></script>
    <link rel="stylesheet" href="template/t16/assets/scripts/theme/default/layer.css?v=3.3.0" id="layuicss-layer">
    <script type="text/javascript" src="template/t16/assets/scripts/bjplus.js"></script>
    <script type="text/javascript" src="template/t16/assets/scripts/tmodjs.js"></script>
    <script type="text/javascript" src="template/t16/assets/scripts/clipboard.min.js"></script> 
  </head>
<body>  
[fh_header]
<div class="single">
   <div class="main">
      <div class="container clearfix" style="min-height: calc(100vh - 399px);">
        <div class="breadcrumbs">当前位置：<span><a href="./"><span>首页</span></a></span> 
          <span class="sep"><i class="fa fa-angle-right"></i></span> 
        <span><a href=""> <span>[S_title]</span></a></span> 
      </div>
        <div class="content-wrap">
          <div class="content">
            <div class="single-related">
          <h3 class="related-title"><i class="icon icon-related"></i> [S_title]</h3>
                    <div class="filters">
                  <div class="filter-item">
                            <div class="filter">


                              <fh-function>
  $sql="select * from sl_psort where S_sub=0 and S_del=0 order by S_id desc";
        s[[
        if($id==$row["S_id"] || getrs("select * from sl_psort where S_id=$id","S_sub")==$row["S_id"]){
        $class="active";
    }else{
    $class="";
}

        $api=$api."<a href=\"?type=product&id=".$row["S_id"]."\" class=\"".$class."\" data-type=\"".$row["S_id"]."\">".$row["S_title"]."</a>";


        ]]
        </fh-function>


                              </div>
                        </div>
                    </div>
                                <div class="lists cols-two relateds clearfix" id="container">
        <fh-function>
if($id==0){
  $sql="select * from sl_product,sl_psort where S_del=0 and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id ".shuxing("N_shuxing")." $M_info $order limit ".(($page-1)*16).",16";
}else{
  if($S_sub==0){
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("N_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_sub=".$id." $order limit ".(($page-1)*16).",16";
  }else{
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("N_shuxing")." $M_info and P_del=0 ".$pa.$M_pinfo."  and P_sort=S_id and S_id=".$id." $order limit ".(($page-1)*16).",16";
  }
}
                s[[

$intro=mb_substr(strip_tags(splitx($row["P_content"],"[fh_free]",0)),0,200,"utf-8");

$sub_title=getrs("select * from sl_psort where S_id=".$row["S_sub"]);
$api=$api."<div class=\"post grid\">
              <div class=\"img\">
                  <a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\">
                  <img src=\"".pic($row["P_pic"])."\" class=\"thumb\" alt=\"".$row["P_title"]."\" style=\"width: 115px\">
                </a>
              </div>
              <div class=\"cat\"><a href=\"?type=product&id=".$row["S_id"]."\">".$row["S_title"]."</a> <a href=\"?type=product&id=".$sub_title["S_id"]."\">".$sub_title["S_title"]."</a></div>
              <h3><a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\">".$row["P_title"]."</a></h3>
              <p class=\"excerpt\" target=\"_blank\">".$row["P_title"]."</p>
              <div class=\"grid-meta\">
                <span class=\"time\"><i class=\"icon icon-time\"></i> ".date("Y-m-d",strtotime($row["P_time"]))."</span>
                <span class=\"views\"><i class=\"icon icon-eye\"></i> ".$row["P_view"]."</span>
                <span class=\"comments\"><i class=\"icon icon-posts\"></i> ￥".p($row["P_price"])."</span>
              </div>
            </div>";
]]

        </fh-function>


    </div>

                
            </div>
            <div id="pager"></div>
          </div>
        </div>
    
    <aside class="sidebar">
      <div class="theiaStickySidebar">
        <div class="widget widget-postlist">
              <h3><i class="icon icon-posts"></i> 最新发布</h3>
              <ul class="clearfix hasimg">


                    <fh-function>
      $i=1;
 $sql="select * from sl_product,sl_psort where S_id=P_sort and S_del=0 and P_del=0 ".$M_pinfo."  order by P_time desc limit 8";
          s[[


      $api=$api."<li onclick=\"location.href='?type=productinfo&id=".$row["P_id"]."'\">
              <a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\" class=\"img\">
                <img src=\"".pic($row["P_pic"])."\" class=\"thumb\" alt=\"".$row["P_title"]."\">
              </a>
              <h4><a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\">".$row["P_title"]."</a></h4>
              <p class=\"meta\">
                <span class=\"time\"><i class=\"icon icon-time\"></i> ".date("Y-m-d",strtotime($row["P_time"]))."</span> 
                <span class=\"views\"><i class=\"icon icon-eye\"></i> ".$row["P_view"]."</span> 
                <span class=\"comments\"><i class=\"icon icon-posts\"></i> ￥".p($row["P_price"])."</span>
              </p>
            </li>";


     $i=$i+1;
     ]]
</fh-function>



                           
                
                    </ul>
                </div>
        
        <div class="widget widget-postlist">
              <h3><i class="icon icon-posts"></i> 最多浏览</h3>
              <ul class="clearfix hasimg">


                    <fh-function>
      $i=1;
 $sql="select * from sl_product,sl_psort where S_id=P_sort and S_del=0 and P_del=0 ".$M_pinfo."  order by P_view desc limit 8";
          s[[


      $api=$api."<li onclick=\"location.href='?type=productinfo&id=".$row["P_id"]."'\">
              <a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\" class=\"img\">
                <img src=\"".pic($row["P_pic"])."\" class=\"thumb\" alt=\"".$row["P_title"]."\">
              </a>
              <h4><a href=\"?type=productinfo&id=".$row["P_id"]."\" target=\"_blank\" title=\"".$row["P_title"]."\">".$row["P_title"]."</a></h4>
              <p class=\"meta\">
                <span class=\"time\"><i class=\"icon icon-time\"></i> ".date("Y-m-d",strtotime($row["P_time"]))."</span> 
                <span class=\"views\"><i class=\"icon icon-eye\"></i> ".$row["P_view"]."</span> 
                <span class=\"comments\"><i class=\"icon icon-posts\"></i> ￥".p($row["P_price"])."</span>
              </p>
            </li>";


     $i=$i+1;
     ]]
</fh-function>



                           
                
                    </ul>

                </div>
      </div>
    </aside>
  </div>
</div>
</div>    

<script id="tpl_empty" type="text/html">
    <div class="infoimg">
      <img src="template/t16/assets//img/nodata.png">
  </div>
</script>
<script language="javascript">
    var page = 1;
    var scrolled = false;
    var current_type = "4006";
    function bindScroller(){
        var loaded = false;
        var stop = true;  
        $(window).scroll(function () {
            if (loaded) {
                return;
            }
            totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
            if ($(document).height() <= totalheight) {
                if (stop == true) {
                    stop = false; scrolled = true;
                    $('#container').append('<div id="credit_loading"><i class="fa fa-spinner fa-spin"></i> 正在加载...</div>');
                    page++;
                    core_json("/index.php?mod=mobile&act=category&do=article&op=category&m=eshop&beid=10", {id:current_type,page: page}, function (morejson) {
                        stop = true;
                        $('#credit_loading').remove();
                        $("#container").append(tpl('tpl_log', morejson.result));
                        if (morejson.result.list.length < morejson.result.pagesize) {
                            $("#container").append('<div id="credit_loading">已经加载完全部记录</div>');
                            loaded = true;
                            $(window).scroll = null;
                            return;
                        }
                    }, true);
                }
            }
        });
    }
    function getLog(type) {
        core_json("/index.php?mod=mobile&act=category&do=article&op=category&m=eshop&beid=10", {id:type,page: page}, function (json) {
            if (json.result.list.length <= 0) {
                $('#container').html(tpl('tpl_empty'));
                return;
            }
            $('#container').html(tpl('tpl_log', json.result));
            bindScroller();
        }, true);
    }
    $('.filter a').unbind('click').click(function () {
     var $currItem = $(this),
      index = $currItem.index();
      $currItem.addClass('active').siblings().removeClass('active');  
        page = 1; current_type = $(this).data('type')
        getLog(current_type);
    }); 
    getLog(current_type);
</script>
<script src="js/jquery.pager.js" type="text/javascript"></script>
<script>
$(".scms-pic").attr("style","float: none;display:inline-block;vertical-align:top;");
$(document).ready(function() {
    $("#pager").pager({ pagenumber: <fh-function> $api=$api.$page;</fh-function>, pagecount: <fh-function> $api=$api.$page_num;</fh-function>, buttonClickCallback: PageClick });
});

PageClick = function(pageclickednumber) {
  window.location="<fh-function>$api=$api.url($url,"page",$_GET["page"]);</fh-function>&page="+pageclickednumber;
}
</script>
[fh_footer]
</body></html>