Example #1
0
    $articlecount = $articledata->GetArticleList($category->cid);
    $total = count($articlecount);
    $take = $category->takenumber;
    $skip = ($curpage - 1) * $take;
    $totalpage = (int) ($total % $take == 0 ? $total / $take : $total / $take + 1);
    $articlelist = $articledata->TakeArticleList($category->cid, $skip, $take);
    $tempinfo->assign("articlelist", $articlelist);
} else {
    if ($category->type == "product") {
        $productdata = new Product();
        $productcount = $productdata->GetProductList($category->cid);
        $total = count($productcount);
        $take = $category->takenumber;
        $skip = ($curpage - 1) * $take;
        $totalpage = (int) ($total % $take == 0 ? $total / $take : $total / $take + 1);
        $productlist = $productdata->TakeProductList($category->cid, $skip, $take);
        $tempinfo->assign("productlist", $productlist);
    } else {
        header("HTTP/1.1 404 Not Found");
        header("Status: 404 Not Found");
        exit;
    }
}
if ($curpage > 1) {
    $category->seotitle = $category->seotitle . ' 第' . $curpage . '页';
}
$tempinfo->assign("category", $category);
$tempinfo->assign("subcategory", $categorydata->GetSubCategory($category->cid, $category->type));
$tempinfo->assign("take", $take);
$tempinfo->assign("total", $total);
$tempinfo->assign("totalpage", $totalpage);
Example #2
0
require_once 'admin.inc.php';
require_once '../include/product.class.php';
require_once '../include/category.class.php';
$cid = $_GET["cid"];
$curpage = $_GET["p"];
$cid = isset($cid) && is_numeric($cid) ? $cid : 0;
$curpage = isset($curpage) && is_numeric($curpage) ? $curpage : 1;
if ($curpage < 1) {
    $curpage = 1;
}
$productdata = new Product();
$total = count($productdata->GetProductList($cid, "pid desc", true));
$take = 20;
$skip = ($curpage - 1) * $take;
$totalpage = (int) ($total % $take == 0 ? $total / $take : $total / $take + 1);
$productlist = $productdata->TakeProductList($cid, $skip, $take, "pid desc", true);
$action = $_POST["action"];
if ($action == "delete") {
    $idarr = $_POST["chk"];
    if (count($idarr) > 0) {
        foreach ($idarr as $id) {
            if (is_numeric($id)) {
                $sql = "DELETE FROM yiqi_product WHERE pid = '{$id}' limit 1";
                $yiqi_db->query(CheckSql($sql));
            }
        }
        ShowMsg("指定产品删除成功");
    }
}
$adminpagetitle = "产品列表";
include "admin.header.php";