Example #1
0
}
$categorydata = new Category();
$category = $categorydata->GetCategoryByName($name);
if ($category == null) {
    header("HTTP/1.1 404 Not Found");
    header("Status: 404 Not Found");
    exit;
}
if ($category->type == "article") {
    $articledata = new Article();
    $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;
Example #2
0
require_once '../include/article.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;
}
$articledata = new Article();
$articlecount = $articledata->GetArticleList($cid, "aid desc", true);
$total = count($articlecount);
$take = 20;
$skip = ($curpage - 1) * $take;
$totalpage = (int) ($total % $take == 0 ? $total / $take : $total / $take + 1);
$articlelist = $articledata->TakeArticleList($cid, $skip, $take, "aid 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_article WHERE aid = '{$id}' limit 1";
                $yiqi_db->query(CheckSql($sql));
            }
        }
        ShowMsg("指定文章删除成功");
    }
}
$adminpagetitle = "文章列表";
include "admin.header.php";