Heim >Backend-Entwicklung >PHP-Tutorial >谁帮我封装下下面代码
<?php$items = array(); $srtpdz = explode(",",$_MODULE["srtpdz"]); $srtpljdz = explode(",",$_MODULE["srtpljdz"]); $srbbbt = explode(",",$_MODULE["srbbbt"]);switch($_MODULE[huoqubaobei]){ case "1": $items = $itemManager->queryByKeyword($_MODULE[guanjianzi],$_MODULE[paixu],$_MODULE[geshu]); break; case "2": $sdItem = $_MODULE[item_1]; if($sdItem=="" || $sdItem ==NULL){ $items = $itemManager->queryByKeyword($_MODULE[guanjianzi],$_MODULE[paixu],$_MODULE[geshu]); }else{ $arr = explode(',',$sdItem); foreach($arr as $value){ $item=$itemManager-> queryById ($value); array_push($items, $item); } } break; case "3": $arr = explode(',',$_MODULE[cate_1]); $items = $itemManager->queryByCategory($categoryId,$_MODULE["paixu"],$_MODULE["geshu"]); break;} $i=-1; foreach($items as $item){ $i++; $istrue='@@'.$_MODULE['xiugai']; if (!strpos($istrue,'1')){ //修改标题标题 $itemTitle=$item->title; } else { $itemTitle = $srbbbt[$i]; } if (!strpos($istrue,'2')){ //修改图片 $itemPicUrl=$item->getPicUrl(310); $gaodu=273; } else { $itemPicUrl = $srtpdz[$i]; $gaodu=$_MODULE['tpgd']; } if (!strpos($istrue,'3')){ //修改地址 $itemUrl = $uriManager->detailURI($item); } else { $itemUrl=$srtpljdz[$i]; } $itemPrice = $item->price; $itemsoldCount = $item->soldCount; $itemID=$item->id; echo'<div class="alll alll'.$i.'"><div class="all"><div class="pic"><a href="'.$itemUrl.'"><img style="max-width:90%".$gaodu.'px;" src="'.$itemPicUrl.'" / alt="谁帮我封装下下面代码" ></a></div><div class="title"><a target="_blank" href="'.$itemUrl.'">'.$itemTitle.'</a></div><div class="share"><div style="color:#FFF;" class="common price">¥'.$itemPrice.'</div><div class="common yishou">已售:'.$itemsoldCount.'件</div><div class="common share1"><ul><li style="width:50px;">分享到:</li>';?><li style="background:url(assets/images/fx1.jpg) no-repeat center center;"><div class="sns-widget fx" data-sharebtn='{"key":"<?php echo $itemID ?>","type":"item","pic":"<?php echo $itemPicUrl ?>","client_id":"68","isShowFriend":"false","skinType":"3"}'></div></li><?phpecho'</ul></div></div></div></div>'; }?>谁帮我封装下这些代码 我想最终形式是
for(....){echo echo'<div class="alll alll'.$i.'"><div class="all"><div class="pic"><a href="'.$itemUrl.'"><img style="max-width:90%".$gaodu.'px;" src="'.$itemPicUrl.'" / alt="谁帮我封装下下面代码" ></a></div><div class="title"><a target="_blank" href="'.$itemUrl.'">'.$itemTitle.'</a></div><div class="share"><div style="color:#FFF;" class="common price">¥'.$itemPrice.'</div><div class="common yishou">已售:'.$itemsoldCount.'件</div><div class="common share1"><ul><li style="width:50px;">分享到:</li>';}
“请”谁封装?
谁帮帮忙!~~~
没人帮忙么没人帮忙么没人帮忙么