* Created by PhpStorm. * User: hssh_win8.1 * Date: 2015/10/7 * Time: 14:13 * file: front/cate.php 前端的栏目页 */ require_once './common/include.php'; // 获得导航条的参数 $cate_id = isset($_GET['cate_id']) ? $_GET['cate_id'] : 1; $navlist = ToolsInfClassify::FamilyTree($ALLCATE, $cate_id); //print_r($navlist); // 获得子栏目 $cur_catelist = ToolsInfClassify::ClassifyForMul($ALLCATE, $cate_id); if (!$cur_catelist) { // 没有子栏目 取父栏目的子栏目 $parent_id = ToolsInfClassify::FamilyTree($ALLCATE, $cate_id)[1]['cate_id']; $cur_catelist = ToolsInfClassify::ClassifyForMul($ALLCATE, $parent_id); } //print_r($cur_catelist);die(); // 本周热销 $hotlist = $mg->select(array('goods_id', 'goods_name', 'goods_price', 'goods_img'), 'is_hot order by sale_total desc limit 0,3'); // 本周新品 $newlist = $mg->select(array('goods_id', 'goods_name', 'goods_price', 'goods_img'), 'is_new order by sale_total desc limit 0,3'); // 或的该栏目下的所有商品 $allCateId = ToolsInfClassify::ChildrenId($ALLCATE, $cate_id); array_unshift($allCateId, $cate_id); // 分页显示 $list_per_page = 16; // 每页显示的条数 $sql = 'select count(*) from bl_goods where cate_id in (' . implode(',', $allCateId) . ')'; $list_total = $mg->getOne($sql);
<?php /** * Created by PhpStorm. * User: hssh_win8.1 * Date: 2015/10/7 * Time: 14:08 * file: front/goods.php 前端的商品页 */ require_once './common/include.php'; // 获得商品信息 $goods_id = isset($_GET['goods_id']) ? $_GET['goods_id'] : 12; $sql = "select * from bl_goods where goods_id=" . $goods_id; $goodsinfo = $mg->getRow($sql); if (!$goodsinfo) { header('location: ' . 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . '/index.php'); } // 获得导航条的参数 $navlist = ToolsInfClassify::FamilyTree($ALLCATE, $goodsinfo['cate_id']); // 本周热销 $hotlist = $mg->select(array('goods_id', 'goods_name', 'goods_price', 'goods_img'), 'is_hot order by sale_total desc limit 0,3'); // 本周新品 $newlist = $mg->select(array('goods_id', 'goods_name', 'goods_price', 'goods_img'), 'is_new order by sale_total desc limit 0,3'); require ROOT . 'view/front/goods.html';