1 Star 0 Fork 0

vworld / surfing-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
channel3c.php 2.52 KB
一键复制 编辑 原始数据 按行查看 历史
guilei.li 提交于 2014-08-12 21:38 . logo navbar
<?php
/**
* Created by PhpStorm.
* User: lscm
* Date: 14-8-6
* Time: 下午4:38
*/
require("common/dbutil.php");
//$dbServer = "localhost";
//$dbUser = "adsAdmin";
//$dbPassword = "";
//$dbName = "surfingHelper";
$con=\common\dbutil::getConnect();
mysqli_set_charset($con,"utf8");
$result = mysqli_query($con,"SELECT * FROM ads WHERE AD_CATEGORY='3c' ORDER BY AD_CATEGORY");
$floors = array('sj'=>'手机', 'bjb'=>'笔记本');
$source_icons = array('jd.com'=>array('pic/img/jd.com.png','京东'),
'taobao.com'=>array('pic/img/taobao.com.png','淘宝'),
'tmall.com'=>array('pic/img/tmall.com.png','天猫'));
$ad_category = "3c";
require("head.php");
function buildItem($data){
global $source_icons;
$html = '<li class="good-item">'.
'<a href="'.$data[ad_target_url].'" target="_blank"><img src="'.$data[ad_material_urls].'"></a>'.
'<br>'.
'<a href="'.$data[ad_target_url].'" class="good-title" target="_blank">'.$data[ad_title].'</a>'.
'<div class="info-wrapper">'.
'<span class="price">¥'.$data[ad_price].'</span>'.
'<span class="source">'.
'<img src="'.$source_icons[$data[ad_from]][0].'">'.
'<span>'.$source_icons[$data[ad_from]][1].'</span>'.
'</span>'.
'</div>'.
'</li>';
return $html;
}
echo("<body>");
require("header.php");
?>
<div id="channelShow" class="container">
<div class="zhainan"></div>
<div class="channel"></div>
</div>
<div class="container">
<div class="main-content">
<?php
$cat_2="";
$floorNum = 0;
for ($i=0; $data = $result->fetch_array(MYSQLI_ASSOC);$i++){
if($data[ad_category_2] != $cat_2){
if($cat_2 != ""){
echo('</ul>');
}
$cat_2 = $data[ad_category_2];
$floorNum+=1;
echo('<ul class="floor clearfix">');
$floorHtml= '<div class="floor-wrapper">'.
'<span class="floor-icon">'.$floorNum.'F</span>'.
'<span class="floor-title">'.$floors[$cat_2].'</span>'.
'</div>';
echo($floorHtml);
}
echo buildItem($data);
}
echo('</ul>');
?>
</ul>
</div>
</div>
</body>
</html>
CSS
1
https://gitee.com/vworld/surfing-helper.git
git@gitee.com:vworld/surfing-helper.git
vworld
surfing-helper
surfing-helper
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891