gusucode.com > 2030网博士成品网站管理系统 PHP网站源码程序 > 2030/dingcan/module/DingCanAllZx.php

    <?php

/*
	[插件名称] 餐品展示与订购-自选餐品
	[适用范围] 首页
*/

define("ROOTPATH", "../../");
include(ROOTPATH."includes/common.inc.php");
include(ROOTPATH."dingcan/includes/dingcan.inc.php");


$act = $_POST['act'];

switch($act){

	case "dingcanall_zx" :

		global $fsql,$msql;
		
		$nowcatid=$_REQUEST["catid"];
		$nowk=$_REQUEST["k"];
		$picw=$_REQUEST["picw"];
		$pich=$_REQUEST["pich"];
		$fittype=$_REQUEST["fittype"];
		$myrp=$_REQUEST["myrp"];
		
		//模板解释
		$Temp=LoadEsetTemp($myrp,"tpl_dingcanall_zx.htm");
		$TempArr=SplitTblTemp($Temp);

		//统计自选餐品一级分类的个数
		$msql->query("select count(catid) from {P}_dingcan_zxcat where pid='0'");
		if($msql->next_record()){
			$cat_nums=$msql->f('count(catid)');
		}
		
		//读取自选餐品的一级分类
		$k=1;
		$msql->query("select * from {P}_dingcan_zxcat where pid='0' order by xuhao");
		while($msql->next_record()){
			$catid=$msql->f('catid');
			$cat_zx=$msql->f('cat');
			
			if($nowk!="" && $nowk!="0"){
				if($k==$nowk){
					$nowcat=$catid;
					$catstr_zx.="<div class='dccat'><div id='cat_zx_".$k."' class='catfontnow' onClick='changeCat(\"zx\",$catid,$cat_nums,$k);'>".$cat_zx."</div>&nbsp;|&nbsp;</div>";
				}else{
					$catstr_zx.="<div class='dccat'><div id='cat_zx_".$k."' class='catfont' onClick='changeCat(\"zx\",$catid,$cat_nums,$k);'>".$cat_zx."</div>&nbsp;|&nbsp;</div>";
				}
			}else{
				if($k==1){
					$nowcat=$catid;
					$catstr_zx.="<div class='dccat'><div id='cat_zx_".$k."' class='catfontnow' onClick='changeCat(\"zx\",$catid,$cat_nums,$k);'>".$cat_zx."</div>&nbsp;|&nbsp;</div>";
				}else{
					$catstr_zx.="<div class='dccat'><div id='cat_zx_".$k."' class='catfont' onClick='changeCat(\"zx\",$catid,$cat_nums,$k);'>".$cat_zx."</div>&nbsp;|&nbsp;</div>";
				}
			}
			
			$k++;
		}
		
		$catstr_zx=substr($catstr_zx,0,-19)."</div>";
			
		$var=array(
			'catstr_zx' => $catstr_zx
		);
			
		if($nowk=="" || $nowk=="0"){
			$str=ShowTplTemp($TempArr["start"],$var);
		}
		
		$str.=$TempArr["rowstart"];
		
		
		//读取首次加载页面是要显示的自选餐品
		//先判断其下有无二级分类
		$msql->query("select * from {P}_dingcan_zxcat where pid='$nowcat'");
		if($msql->next_record()){
			$ifhave="yes";
		}else{
			$ifhave="no";
		}
			
		if($ifhave=="yes"){  //其下有二级分类时
			$msql->query("select * from {P}_dingcan_zxcat where pid='$nowcat'");
			while($msql->next_record()){  
				$scatid=$msql->f('catid');
				$scat=$msql->f('cat');
				
				$propstr="";
				$fsql->query("select * from {P}_dingcan_zxcon where catid='$scatid' and iffb='1'");
				while($fsql->next_record()){
					$id=$fsql->f('id');
					$title=$fsql->f('title');
					$zhuliao=$fsql->f('zhuliao');
					$kouwei=$fsql->f('kouwei');
					$perprice=$fsql->f('perprice');
					$percopy=$fsql->f('percopy');
					$sparecopy=$fsql->f('sparecopy');
					$mcent=$fsql->f('mcent');
					$xuhao=$fsql->f('xuhao');
					$memo=$fsql->f('memo');
					$cl=$fsql->f('cl');
					$tj=$fsql->f('tj');
					$iffb=$fsql->f('iffb');
					$src=$fsql->f('src');
					$uptime=$fsql->f('uptime');
					
					$src=$myrp.$src;
					
					$memo=str_replace("\n", "<br />", $memo);
					
					$pstr=str_replace("{#picw#}",$picw,$TempArr["m1"]);
					$pstr=str_replace("{#id#}",$id,$pstr);
					$pstr=str_replace("{#pich#}",$pich,$pstr);
					$pstr=str_replace("{#src#}",$src,$pstr);
					$pstr=str_replace("{#title#}",$title,$pstr);
					$pstr=str_replace("{#zhuliao#}",$zhuliao,$pstr);
					$pstr=str_replace("{#kouwei#}",$kouwei,$pstr);
					$pstr=str_replace("{#perprice#}",$perprice,$pstr);
					$pstr=str_replace("{#mcent#}",$mcent,$pstr);
					$pstr=str_replace("{#sparecopy#}",$sparecopy,$pstr);
					$pstr=str_replace("{#memo#}",$memo,$pstr);
	
					$propstr.=$pstr;
					
				}
				
				$var=array(
					'id' => $id,
					'scat' => $scat,
					'propstr' => $propstr
				);
				
				$str.=ShowTplTemp($TempArr["list"],$var);
			}
				
		}else{  //其下没有二级分类时
			
			$fsql->query("select * from {P}_dingcan_zxcon where catid='$nowcat' and iffb='1'");
			while($fsql->next_record()){
				$id=$fsql->f('id');
				$title=$fsql->f('title');
				$zhuliao=$fsql->f('zhuliao');
				$kouwei=$fsql->f('kouwei');
				$perprice=$fsql->f('perprice');
				$percopy=$fsql->f('percopy');
				$sparecopy=$fsql->f('sparecopy');
				$mcent=$fsql->f('mcent');
				$xuhao=$fsql->f('xuhao');
				$memo=$fsql->f('memo');
				$cl=$fsql->f('cl');
				$tj=$fsql->f('tj');
				$iffb=$fsql->f('iffb');
				$src=$fsql->f('src');
				$uptime=$fsql->f('uptime');
					
				$src=$myrp.$src;
				
				$memo=str_replace("\n", "<br />", $memo);
				
				$var=array(
					'id' => $id,
					'picw' => $picw,
					'pich' => $pich,
					'src' => $src,
					'title' => $title,
					'zhuliao' => $zhuliao,
					'kouwei' => $kouwei,
					'perprice' => $perprice,
					'mcent' => $mcent,
					'sparecopy' => $sparecopy,
					'scat' => $scat,
					'memo' => $memo,
					'propstr' => $propstr
				);
					
				$str.=ShowTplTemp($TempArr["m2"],$var);
				
			}
			
		}
		
		$str.=$TempArr["rowend"];
				
		$var=array(
			'fittype' => $fittype
		);
			
		$str.=ShowTplTemp($TempArr["end"],$var);
				
		echo "OK::".$str;
		exit;
	
	break;


}
?>