<?php define('ACC', true); require './include/init.php'; // 取出5条新品 $goods = new GoodsModel(); $newlist = $goods->getNew(5); /* 取出指定栏目的商品 */ // 女士大栏目下的商品 $female_id = 4; $felist = $goods->catGoods($female_id); // 男士大栏目下的商品,同学们自己来完成 include ROOT . 'view/front/index.html';
@Author:GongBiao @Date:2015/07/03 */ header('Content-Type:text/html; charset=utf-8'); define('ACC', true); require('./include/init.php'); //取出5条新品 $goods = new GoodsModel(); $newlist = $goods->getNew(5); //取出女士正装商品 $female_id = 4; $flist = $goods->catGoods($female_id); //取出男士正装商品 $male_id = 1; $mlist = $goods->catGoods($male_id); /* echo '<pre>'; print_r($mlist); echo '</pre>'; exit; */
if(empty($category)){ header('location: index.php'); exit; } //取出树状导航 $cats = $cat->select(); //取出所有栏目 $sort = $cat->getCatTree($cats, 0, 1); //把取出的栏目排序 //取出面包屑导航 $nav = $cat->getTree($cat_id); //取出栏目下的商品 $goods = new GoodsModel(); $goodlist = $goods->catGoods($cat_id); /* echo '<pre>'; print_r($goodlist); echo '</pre>'; exit; */ include(ROOT . 'view/front/lanmu.html'); ?>
$cat_id = isset($_GET['cat_id']) ? $_GET['cat_id'] + 0 : 0; $page = isset($_GET['page']) ? $_GET['page'] + 0 : 1; if ($page < 1) { $page = 1; } $goodsModel = new GoodsModel(); $total = $goodsModel->catGoodsCount($cat_id); // 每页取2条 $perpage = 2; if ($page > ceil($total / $perpage)) { $page = 1; } $offset = ($page - 1) * $perpage; $pagetool = new PageTool($total, $page, $perpage); $pagecode = $pagetool->show(); $cat = new CatModel(); $category = $cat->find($cat_id); if (empty($category)) { header('location: index.php'); exit; } // 取出树状导航 $cats = $cat->select(); // 获取所有的栏目 $sort = $cat->getCatTree($cats, 0, 1); // 取出面包屑导航 $nav = $cat->getTree($cat_id); // 取出栏目下的商品 $goods = new GoodsModel(); $goodslist = $goods->catGoods($cat_id, $offset, $perpage); include ROOT . 'view/front/lanmu.html';