?? tcprop.php
?? 推薦的一本書!!!!建議看 !!!!!!!!!
?? PHP
字號:
??
<?php
/*
[插件名稱] 商品套餐參數列表 - 替換模版標簽{#modTcProp#}
[適用范圍] 頻道詳情頁
[文 件 名] TcProp.php
[更新時間] 2007/3/5
*/
function TcProp(){
global $msql,$fsql,$tbl_goodsprop,$tbl_goodsprop_list,$tbl_shop_con,$NowMenuid,$ArrayShopDetail,$MenuInfo;
$PSET=PlusSet("modTcProp");
$tempname=PlusDef($PSET["tempname"],"tpl_goodsprop_tc.htm");
$goodstype=$ArrayShopDetail["goodstype"];
$tcall=$ArrayShopDetail["tcall"];
$fsall=$ArrayShopDetail["fsall"];
//模版解釋
$Temp=LoadTemp(ROOTPATH."templates/".$MenuInfo["skin"]."/".$tempname);
$TempArr=SplitTblTemp($Temp);
$str=$TempArr["start"];
$i=1;
$msql->query("select * from $tbl_goodsprop where goodstype='$goodstype' order by xuhao");
while($msql->next_record()){
$propid=$msql->f('id');
$propname=$msql->f('propname');
$proptype=$msql->f('proptype');
$ifsel=$msql->f('ifsel');
$ifdetail=$msql->f('ifdetail');
$pn="prop".$i;
if($proptype=="list"){
if($ifsel=="1"){
$pnlist="";
$arr=explode(",",$ArrayShopDetail[$pn]);
$arrnums=sizeof($arr);
if($arrnums<=0){
$pnlist="<option value='".$ArrayShopDetail[$pn]."'>".$ArrayShopDetail[$pn]."</option>";
}else{
for($m=0;$m<sizeof($arr);$m++){
$pnlist.="<option value='".$arr[$m]."'>".$arr[$m]."</option>";
}
}
$pstr=str_replace("{#propname#}",$propname,$TempArr["menu"]);
$pstr=str_replace("{#pnlist#}",$pnlist,$pstr);
$pstr=str_replace("{#pn#}",$pn,$pstr);
}else{
$pstr=str_replace("{#propname#}",$propname,$TempArr["list"]);
$pstr=str_replace("{#prop#}",$ArrayShopDetail[$pn],$pstr);
}
}else{
$pstr=str_replace("{#propname#}",$propname,$TempArr["list"]);
$pstr=str_replace("{#prop#}",$ArrayShopDetail[$pn],$pstr);
}
if($ifdetail=="1"){
$str.=$pstr;
}
$i++;
}
$str.=$TempArr["end"];
//套餐內商品
$TcArrs=TcAll($TempArr,$tcall);
$tcpriceall=$TcArrs["tcpriceall"];
$tcstr=$TcArrs["tcstr"];
$str=str_replace($TempArr["tclist"],$tcstr,$str);
$str=str_replace("{#tcpriceall#}",$tcpriceall,$str);
//附屬商品
$fsstr=FushuAll($TempArr,$fsall);
$str=str_replace($TempArr["fslist"],$fsstr,$str);
return $str;
}
//套餐內商品讀取
function TcAll($TempArr,$tcall){
global $tsql,$charset,$tbl_shop_con,$CatchOpen;
global $MenuInfo,$CONF;
$tcpriceall=0;
$tcarr=explode("|",$tcall);
for($u=0;$u<sizeof($tcarr)-1;$u++){
if($tcarr[$u]!=""){
$xarr=explode("*",$tcarr[$u]);
if(sizeof($xarr)<=1){
$xid=$tcarr[$u];
$tcnums=1;
}else{
$xid=$xarr[0];
$tcnums=$xarr[1];
}
$tsql->query("select * from $tbl_shop_con where id='$xid'");
if($tsql->next_record()){
$gid=$tsql->f('id');
$menuid=$tsql->f('menuid');
$goodstype=$tsql->f('goodstype');
$title=$tsql->f('title');
$memo=$tsql->f('memo');
$src=$tsql->f('picsmall');
$xtmod=$tsql->f('xtmod');
$bn=$tsql->f('bn');
$brand=$tsql->f('brand');
$danwei=$tsql->f('danwei');
$kucun=$tsql->f('kucun');
$price0=$tsql->f('price0');
$price1=$tsql->f('price1');
$price2=$tsql->f('price2');
$price3=$tsql->f('price3');
$price4=$tsql->f('price4');
$price5=$tsql->f('price5');
$price6=$tsql->f('price6');
$price7=$tsql->f('price7');
$price8=$tsql->f('price8');
$price9=$tsql->f('price9');
$price10=$tsql->f('price10');
$price11=$tsql->f('price11');
$price12=$tsql->f('price12');
//價格
$price=NowPrice($gid,$goodstype,$price1,$price2,$price3,$price4,$price5,$price6,$price7,$price8,$price9,$price10,$price11,$price12);
$tcprice0=$price0*$tcnums;
$tcprice=$price*$tcnums;
$tcprice=number_format($tcprice,2,'.','');
$tcprice0=number_format($tcprice0,2,'.','');
$tcpriceall=$tcpriceall+$tcprice;
//詳情鏈接
$fold=MenuFold($menuid);
if($CatchOpen=="1" && file_exists(ROOTPATH.$fold."/html/".$gid.".html")){
$link=ROOTPATH.$fold."/html/".$gid.".html";
}else{
$link=ROOTPATH.$fold."/html/?".$gid.".html";
}
//簡介
$memo=str_replace("\n","<br>",$memo);
$var=array (
'tcgoods' => $title,
'tcmemo' => $memo,
'tcnums' => $tcnums,
'tcsrc' => $src,
'tcdanwei' => $danwei,
'tclink' => $link,
'tcbn' => $bn,
'tcprice' => $tcprice,
'tcprice0' => $tcprice0
);
$tcstr.=ShowTplTemp($TempArr["tclist"],$var);
}
}
}
$tcpriceall=number_format($tcpriceall,2,'.','');
$TcArrs=array (
'tcstr' => $tcstr,
'tcpriceall' => $tcpriceall
);
return $TcArrs;
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -