HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.2.20
System: Linux 825a8fd6cf8c 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User: apache (48)
PHP: 8.2.20
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/themes/frameMyrskyNew/led_list.php
<?php
/**
 * @package WordPress
 * @subpackage frameLED_Theme
 */
/*
Template Name: Led Product List 
*/
?>
<?php get_header() ?>
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-1.4.2.min.js"></script>
<?php /* if (have_posts()) : while (have_posts()) : the_post(); 
						$erp_page_path = get_the_content(); 

				 		wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));

		 			endwhile; endif; 
					echo "http://".$_SERVER['SERVER_NAME'].'/'.$erp_page_path; 
			*/
	if (have_posts()) : while (have_posts()) : the_post(); 
						$cat = get_the_content(); 
		endwhile; endif; 
			
?> 

<?php
	include_once("stock_manage.php");
	//include_once("config.php");
	$part_id = $_GET["part_id"];
	$SaleManage  = new SaleManage();
	$ProductList = $SaleManage->getProductList();
	$left_menu   = '';
	foreach($ProductList as $listKey=>$listInfo){
		//$kindName   = $ProListName[$listKey];
		//$kindName   =ucfirst(str_replace("_"," ",$listKey));	
		$left_menu .= "<h2><a href='".get_bloginfo('url')."/product-list/?kind=$listKey'>".$SaleManage->getCategoryChinaName($listKey,"zh")."</a><span class='arrow'></span></h2><ul style='display:none;'>";
		foreach($listInfo as $proKey=>$proInfo){
			$tmp = iconv("utf-8","GB2312",$proInfo);	//防止UTF-8中文被截取成两半		
			$proInfo = strlen($tmp)>20 ? substr ($tmp,0,20)."..." : $tmp;//处理长度
			$left_menu .="<li><a href='".get_bloginfo('url')."/product-detail/?part_id=$proKey'>".iconv("GB2312","utf-8",$proInfo)."</a></li>";    
		}
		$left_menu .='</ul>';
	}
	//$search_key = $_GET["search_key"];
	$search_key = $_GET["searchKey"];
	$kind       = $_GET["kind"];
	if(!empty($cat)&&in_array($cat,$servers['category'])){
		$category = $cat;
	}else{
		$category = $kind ? array($kind) : null;
	}
	
	$StockManage = new StockManage();
	$ProListName = $SaleManage->getProListName();		
	$total_record_count = -1;
	$StockManage->getProducts($category,$search_key,null,&$total_record_count);	
	$pageSize  = 12;
	$pageCount = $total_record_count/$pageSize>1?ceil($total_record_count/$pageSize):1;
	$page      = $_GET["page"] ? $_GET["page"]:1;
	$showCount = 10; 
	$PrevPage = $page-1;
	if ($PrevPage>=1){		
		$Prev = "<a href='".get_bloginfo('url')."/product-list/?kind=$kind&page=$PrevPage&searchKey=$search_key'>上一页</a>";
	}else{
		$Prev = '<span>上一页</span>';
	}
	//$Tpl->SetVar("Prev",$Prev);
	$nextPage = $page+1;
	if ($nextPage>0 && ($nextPage<=$pageCount)){		
		$Next = "<a href='".get_bloginfo('url')."/product-list/?kind=$kind&page=$nextPage&searchKey=$search_key'>下一页</a>";
	}else{
		$Next = '<span>下一页</span>';
	}
	//$Tpl->SetVar("Next",$Next);
	if($pageCount<$showCount){
		$pageB=1;
		$pageE=$pageCount;
	}else if($pageCount>=$showCount){
		if($page-$showCount/2 <=0){
			$pageB = 1;
			$pageE = $showCount;
		}else{	
			$pageB = $page-($showCount/2);		
			$pageE = $page+($showCount/2);	
		}
	}
	$pageDH = '';
	for($i=$pageB;$i<=$pageE;$i++){	
		$pageDH .= "<td><a href='".get_bloginfo('url')."/product-list/?kind=$kind&page=$i&searchKey=$search_key'>$i</a></td>";
	}
	//$Tpl->SetVar("pageDH",$pageDH);
	$start_id = ($page-1)*$pageSize;	
	
	if(!empty($search_key)){
		$proList = $StockManage->getProducts($category,$search_key,null,&$total_record_count,$start_id,$pageSize);
	}else{
		$proList = $StockManage->getProducts($category,null,null,&$total_record_count,$start_id,$pageSize);
	}	
	//$Tpl->SetVar("kind",$kind);
	$kindName = $SaleManage->getCategoryChinaName($kind,"zh");
?>
  <div class="leftMenu led-box">
	<h2 class="led-box-head"><span class="ledBackground left-circle"></span><a href="<?php bloginfo('url');?>/product-list/?">产品列表</a><span class="ledBackground right-circle"></span> </h2>
	<div class="led-box-body">
		<div class="listMenu">
		<?php echo $left_menu; //左边产品导航?>
		</div>		
	</div> 
	<span class="led-box-bottom"><span class="left-circle-bottom ledBackground"></span><span class="right-circle-bottom ledBackground"></span></span>
  </div>
  <!--右边开始-->  
  <div class="rightProduct">
  	<div style="margin-top:10px">
	<!-- BEGIN EditableGrid searchForm -->
	<form name="searchForm" action="?do=search" method="GET">
		<label>产品搜索</label>
		<input type="text" name="searchKey" id="searchKey"/>
		<!-- BEGIN Button btn_search -->
		<input name="led_search" type="submit" value="  搜索" class="SearchButton">
		<!-- END Button btn_search -->
	</form>
	<!-- END EditableGrid searchForm -->
	</div>
    <div class="led-box">
      <h2 class="led-box-head">
      <span class="ledBackground left-circle"></span>
      <a href="#"><?php echo $kindName?></a>
      <span class="ledBackground right-circle"></span>  
      </h2>
      <div class="led-box-body led_list">
        <ul class="pro_list">
		  <!-- BEGIN proList -->
		  <?php
		  if(empty($proList)) {	  
		  ?>
		  <li style="font-size:16px;">没有查询到相关产品。</li>
		  <?php
		  }else{
			  foreach($proList as  $proInfo){	
				$proName = $proInfo['name'] ;
				$pid     = $proInfo['part_id'] ;
				$img_url = $proInfo['img_url'];
				$proImg  = "http://".$_SERVER['SERVER_NAME'].'/code/'.$proInfo['img_url'] ;
				if(empty($img_url)){
					$proImg = "http://".$_SERVER['SERVER_NAME'].'/code/led/images/none.jpg';
				}?>			
			  <li>
			  <a href="<?php bloginfo('url');?>/product-detail/?part_id=<?php echo $pid;?>" ><img src="<?php echo $proImg;?>" alt="<?php echo $proName;?>" /></a><br>
			  <a href="<?php bloginfo('url');?>/product-detail/?part_id=<?php echo $pid;?>" ><?php echo $proName;?></a>
			  </li>
		    <?php 
			} 
		  }
		  ?>
		  <!-- END proList -->
		</ul>
        <div class="clear"></div>
        <div class="pagination">
          <table cellPadding="0"  cellSpacing="0" id="pageDH">
            <tr>
              <td class="esp"><?php echo $Prev;?></td>
           	  <?php echo $pageDH;?>
              <td class="esp"><?php echo $Next;?></td>
            </tr>
          </table>
        </div>
      </div>      
      <span class="led-box-bottom">
      <span class="left-circle-bottom ledBackground"></span>
      <span class="right-circle-bottom ledBackground"></span>
      </span>
    </div>
  </div>
  <!--右边结束-->
</div> 
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/led.js"></script>
<?php get_footer() ?>