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

$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=$_GET["M_id"];
if($page==""){
  $page=1;
}
if($M_id!=""){
  $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 ".$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 ".$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 ".$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 class="  ">
<head>
<meta name="renderer" content="webkit">
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="generator" content="author"  data-variable="/,cn,10001,,10001,M1156014" />
<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/t1/skin/css/index.css'>
<link href="css/Pager.css" rel="stylesheet" type="text/css" />

</head>
<body>
<!--[if lte IE 8]>
<div class="text-center padding-top-50 padding-bottom-50 bg-blue-grey-100">
  <p class="browserupgrade font-size-18">
	你正在使用一个<strong>过时</strong>的浏览器。请<a href="http://browsehappy.com/" target="_blank">升级您的浏览器</a>，以提高您的体验。
  </p>
</div>
<![endif]-->
<div class="load-box"></div>
<header>

  <div class="head-box">
    <div class="container">
      <div class="head-left">
        <div class="head-left-wrapper">
          <div class="head-left-slide">
            <p>欢迎来到[fh_title]！</p>
            <font>
            <hr>
            <a id="met-weixins"><i class="fa fa-weixin" data-plugin="webuiPopover" data-trigger="hover" data-animation="pop" data-placement='bottom' data-width='130' data-padding='0' data-content="<img src='media/[fh_qrcode]' alt='[fh_title]' style='width: 120px;display:block;margin:auto;'>"></i></a>
            
             </font> </div>
        </div>
      </div>
      <div class="head-right"> 
        <fh-function>
      if($_SESSION["M_login"]==""){
        $api=$api."<a class=\"login\" href=\"member/login.php\">登录</a>
              <hr>
              <a class=\"login\" href=\"member/reg.php\">注册</a>";
      }else{
        $api=$api."<a class=\"login\" href=\"member\">".$_SESSION["M_login"]."</a>
              <hr>
              <a class=\"login\" href=\"member/login.php?action=unlogin\">退出</a>";
      }
        </fh-function>
        <li class="dropdown shopcut"> <a href="member/cart.php"> <i class="icon wb-shopping-cart" aria-hidden="true"></i> <font>购物车</font> <span class="badge badge-danger up hide topcart-goodnum"></span> </a> </li>
      </div>
    </div>
  </div>
  <nav>
    <div class="neck-box">
      <div class="container">
        <div class="logo-box"> <a href="./" title="[fh_title]"> <img src="media/[fh_logo]" alt="[fh_title]"> <img src="media/[fh_logo]" alt="[fh_title]"> </a> </div>
        <div class="search-box">
          <div class="search-cut">
                        <p> 　
<fh-function>
$keyword=explode(",",$H_data["C_hotwords"]);
for($i=0;$i<count($keyword);$i++){
  $api=$api."<a href=\"./?type=search&keyword=".$keyword[$i]."\">".$keyword[$i]."</a>";
}
</fh-function>
  </p>
            <form  name="formsearch" action="./?type=search" method="post">
              <input type="text" name="keyword" value="" placeholder="输入关键词">
              <button class="fa fa-search" type="submit"></button>
            </form>
          </div>
        </div>
        <div class="nav-box index">
          
          <div class="nav-cut">
            <ul class="nav-ul">

              <fh-function>
                $sql="select * from sl_menu where U_hide=0 and U_del=0 and U_sub=0 order by U_order,U_id desc";
                s[[

                if($row["U_id"]==getrs("select * from sl_menu where U_hide=0 and U_del=0 and U_type='product' and U_typeid=$id","U_id") || $row["U_id"]==getrs("select * from sl_menu where U_hide=0 and U_del=0 and U_type='product' and U_typeid=$id","U_sub")){
                    $class="nav-li active";
                  }else{
                    $class="nav-li margin-left-0";
                  }

                  if($row["U_type"]=="link"){
                    $link=$row["U_link"];
                    $target="_blank";
                  }else{
                    $link="?type=".$row["U_type"]."&id=".$row["U_typeid"];
                    $target="_self";
                  }
                        $api=$api."<li class=\"".$class."\"><a href=\"".$link."\" target=\"".$target."\" title=\"".$row["U_title"]."\" >".$row["U_title"]."</a></li>";
                    ]]

              </fh-function>
            </ul>
          </div>
          <div class="nav-hover">

            <fh-function>
            $sql="select * from sl_menu where U_hide=0 and U_del=0 and U_sub=0 order by U_order,U_id desc";
                s[[
                $api=$api."<ul>";

                    $sql2="select * from sl_menu where U_hide=0 and U_del=0 and U_sub=".$row["U_id"]." order by U_order,U_id desc";
                    s2[[
                      
                      if($row2["U_type"]=="link"){
                        $link2=$row2["U_link"];
                        $target="_blank";
                      }else{
                        $link2="?type=".$row2["U_type"]."&id=".$row2["U_typeid"];
                        $target="_self";
                      }
                            $api=$api."<li><a href=\"".$link2."\" target=\"".$target."\" title=\"".$row2["U_title"]."\" >".$row2["U_title"]."</a></li>";
                        ]]

                  $api=$api."</ul>";
                    ]]

            </fh-function>
            
          </div>
        </div>
      </div>
    </div>
  </nav>
  <div class="met-banner-ny vertical-align text-center" style=''>
    <h1 class="vertical-align-middle" style='color:#ffffff;'>[S_title]</h1>
  </div>
</header>

<div class="column-side ">
  <div class="container mobile-not-padding">
    <div class="column-nav">
      <ol class="column-ul">
<li><a>商品分类：</a></li>
        <li class="column-li <fh-function>if($id==0){$api=$api."active";}else{$api=$api."";}</fh-function>"> <a href="?type=product&id=0">全部商品</a> </li>
        
<fh-function>

$sql="select * from sl_psort where S_del=0 and S_sub=0 order by S_order,S_id desc";
                s[[

	            if($row["S_id"]==$id || $row["S_id"]==getrs("select S_sub from sl_psort where S_id=$id","S_sub")){
	                $active="active";
	            }else{
	            	$active="";
	        	}
                  $api=$api."<li class=\"column-li navs ".$active."\"> <a href=\"?type=product&id=".$row["S_id"]."\" title=\"".$row["S_title"]."\" >".$row["S_title"]."</a> </li>";
                ]]
</fh-function>
        
      </ol>
    </div>
    <div class="column-hover">
      <ul>
      </ul>
      <ul>
      </ul>

<fh-function>
$sql="select * from sl_psort where S_del=0 and S_sub=0 order by S_order,S_id desc";
                s[[
$api=$api."<ul class=\"has\">";
$sql2="select * from sl_psort where S_del=0 and S_sub=".$row["S_id"]." order by S_order,S_id desc";
                s2[[
                  $api=$api."<li><a href=\"?type=product&id=".$row2["S_id"]."\" title=\"".$row2["S_title"]."\" >".$row2["S_title"]."</a></li>";
                ]]
$api=$api."</ul>";

                ]]
</fh-function>
    </div>
  </div>
</div>

<div style="height: 10px;background: #f7f7f7"></div>
<div class="column-side " style="z-index: 1">
  <div class="container mobile-not-padding">
<fh-function>

$arr = array();
if($id==0){
  //$sql="select * from sl_product where P_del=0 ".$M_pinfo."  $M_info order by P_top desc,P_order,P_id desc";
}else{
  if($S_sub==0){
    $sql="select * from sl_product,sl_psort where S_del=0 $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_sub=".$id." order by P_top desc,P_order,P_id desc";
  }else{
    $sql="select * from sl_product,sl_psort where S_del=0 $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_id=".$id." order by P_top desc,P_order,P_id desc";
  }
}

$result = mysqli_query($conn,  $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
        $sx=explode("\r\n",$row["P_shuxing"]);
        for($i=0;$i<count($sx);$i++){
          if(splitx($sx[$i],":",0)!=""){
            $c=json_decode("{\"S_title\":\"".splitx($sx[$i],":",0)."\"}",true);
            if(!is_haves($c,$arr)){
              array_push($arr,$c);
            }
          }
        }
    }
} 


for($i=0;$i<count($arr);$i++){
  $arr[$i]["list"]=array();
  $result = mysqli_query($conn,  $sql);
  if (mysqli_num_rows($result) > 0) {
  while($row = mysqli_fetch_assoc($result)) {
          $sx=explode("\r\n",$row["P_shuxing"]);
          for($m=0;$m<count($sx);$m++){
            $s=splitx($sx[$m],":",0);
            if($s==$arr[$i]["S_title"]){
              $v=splitx($sx[$m],":",1);
                if($v!=""){
                  $x=json_decode("{\"shuxing\":\"".$v."\"}",true);
                  if(!is_haves($x,$arr[$i]["list"])){
                    array_push($arr[$i]["list"],$x);
                  }
                }
            }
        }
      }
  }
}


for($i=0;$i<count($arr);$i++){
  for($j=0;$j<count($arr[$i]["list"]);$j++){
    if($_GET["f".$i]==$arr[$i]["S_title"].":".$arr[$i]["list"][$j]["shuxing"]){
      $selected="active";
    }else{
      $selected="";
    }

    $shuxing=$shuxing."<li class=\"".$selected."\"> <a style=\"padding:10px;\" href=\"".url($url,"f".$i,$_GET["f".$i])."&f".$i."=".$arr[$i]["S_title"].":".$arr[$i]["list"][$j]["shuxing"]."\" >".$arr[$i]["list"][$j]["shuxing"]."</a> </li>";

  }

if($_GET["f".$i]==""){
  $selected="active";
}else{
  $selected="";
}

  $api=$api. "
  <div class=\"column-nav\"><ol class=\"column-ul\"><li><a style=\"padding:10px;\">".$arr[$i]["S_title"]."：</a></li><li class=\"".$selected."\"><a style=\"padding:10px;\" href=\"".url($url,"f".$i,$_GET["f".$i])."&f".$i."=\">不限</a></li>".$shuxing."</ol></div>";
  $shuxing="";
}

</fh-function>
</div>
</div>

<div class="grey-box">
  <div class="container">
    <div class="host-cut">
      <div class="host-list active">
        <ul class="blocks-2 blocks-sm-3 blocks-md-4 blocks-xlg-5  met-page-ajax met-grid" id="met-grid" data-scale='1'>

<fh-function>
if($id==0){
  $sql="select * from sl_product where P_del=0 ".$M_pinfo."  ".shuxing("P_shuxing")." $M_info order by P_top desc,P_order,P_id desc limit ".(($page-1)*10).",10";
}else{
  if($S_sub==0){
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_sub=".$id." order by P_top desc,P_order,P_id desc limit ".(($page-1)*10).",10";
  }else{
    $sql="select * from sl_product,sl_psort where S_del=0 ".shuxing("P_shuxing")." $M_info and P_del=0 ".$M_pinfo."  and P_sort=S_id and S_id=".$id." order by P_top desc,P_order,P_id desc limit ".(($page-1)*10).",10";
  }
}

    s[[

            if($row["P_mid"]==0){
                $zy="<span style=\"font-size:12px;background:#c81623;border-radius:5px;padding:1px 3px;color:#ffffff;margin-right:5px;display:inline;\">自营</span>";
              }else{
                $zy="";
            }

      $api=$api."<li class=\"shown scms-pic\"> <a href=\"?type=productinfo&id=".$row["P_id"]."\" title=\"".$row["P_title"]."\"> 

        <div style=\"background-image:url(".pic(splitx($row["P_pic"],"|",0)).");background-repeat: no-repeat;background-position:center center;width:100%;height:200px;background-size: cover;margin:20px auto 25px auto\" class=\"sss\"></div>
         <span> <b>".$zy.$row["P_title"]."</b> <i>&nbsp;</i>
<p><span style=\"font-weight:bold;text-align:left\">￥".p($row["P_price"])."</span>  <span style=\"color: #999999;float:right;margin-top:-20px;\">已售：".$row["P_sold"]."件</span></p>
</span> </a> </li>";
                ]]
</fh-function>

        </ul>
        <div>
<div class='met_pager'>
<div id="pager"></div>
</div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="container">
  <div class="foot-service">
    <ul class="foot-service-wraper">
      <li class="foot-service-slide"><a  title="正品保证"><i class="fa fa-diamond"></i>正品保证</a></li>
      <li class="foot-service-slide"><a  title="如实描述"><i class="fa fa-camera-retro"></i>如实描述</a></li>
      <li class="foot-service-slide"><a  title="专业配送"><i class="fa fa-truck"></i>专业配送</a></li>
      <li class="foot-service-slide"><a  title="金牌服务"><i class="fa fa-heart-o"></i>金牌服务</a></li>
      <li class="foot-service-slide"><a  title="万千信赖"><i class="fa wb-gallery"></i>万千信赖</a></li>
    </ul>
  </div>
  <div class="foot-content">
    <div class="foot-nav">
      <ul class="foot-nav-wraper">

        <fh-function>
                $sql="select * from sl_menu where U_hide=0 and not U_type='index' and not U_type='link' and U_del=0 and U_sub=0 order by U_order,U_id desc";
                s[[
                  
                  $api=$api."<li class=\"foot-nav-slide\"> <b><a href=\"?type=".$row["U_type"]."&id=".$row["U_typeid"]."\"  title=\"".$row["U_title"]."\">".$row["U_title"]."</a></b>
          <ol>";

            $sql2="select * from sl_menu where U_hide=0 and U_del=0 and U_sub=".$row["U_id"]." order by U_order,U_id desc";
                s2[[
                  $api=$api."<li><a href=\"?type=".$row2["U_type"]."&id=".$row2["U_typeid"]."\"  title=\"".$row2["U_title"]."\">".$row2["U_title"]."</a></li>";
                ]]

          $api=$api."</ol>
        </li>";
                    ]]

              </fh-function>
        
      </ul>
    </div>
    <div class="foot-text"> <b><a href="tel:[fh_phone]" title="[fh_phone]">[fh_phone]</a></b> <i>服务时间 9:00-22:00</i>
      <p> <a id="met-weixin"><i class="fa fa-weixin light-green-700" data-plugin="webuiPopover" data-trigger="hover" data-animation="pop" data-placement='top' data-width='160' data-padding='0' data-content="<img src='media/[fh_qrcode]' style='width: 150px;height:150px;display:block;margin:auto;'>"></i></a> 
        
      </p>
    </div>
  </div>
</div>
<footer>
  <div class="container">
    <div class="met-links">
      <ol class="breadcrumb">
        <li>友情链接 :</li>
        <fh-function>
        $sql="select * from sl_link where L_del=0 order by L_id desc";
                s[[
                        $api=$api."<li><a href=\"".$row["L_link"]."\" target=\"_blank\">".$row["L_title"]."</a>  </li>";
                    ]]
        </fh-function>
      </ol>
    </div>
    <p>
    <p>
[fh_copyright][fh_beian][fh_code]
      </p>
    </p>
  </div>
</footer>

<button type="button" class="btn btn-icon btn-primary btn-squared met-scroll-top hide"><i class="icon wb-chevron-up" aria-hidden="true"></i></button>
<button type="button" onclick="window.location.href='member/cart.php'" class="btn btn-icon btn-primary btn-squared met-scroll-top hide" style="bottom: 50px;"><i class="icon wb-shopping-cart" aria-hidden="true"></i></button>
<script src="template/t1/skin/js/shop_lang_cn.js"></script> 
<script src="template/t1/skin/js/index.js"></script> 
<script src="template/t1/skin/js/shop_v3.js"></script>

<script src="js/jquery.pager.js" type="text/javascript"></script>
<script>
$(".sss").height($(".sss").width());
$(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_kefu]
</body>
</html>