示例#1
0
<?php

include_once "../../../includes/config.inc.php";
check_login();
//验证是否登录
$model = new Model_ApplistHptShopPic();
$smarty->assign('cateName', '幻灯片');
//数据保存
if ($_REQUEST['a'] == 'add') {
    if (method_is('post')) {
        $data = $_POST;
        $res = $model->add($data);
        echo json_encode($res);
        die;
    } else {
        $id = (int) $_GET['id'];
        if ($id) {
            $smarty->assign('vo', $model->find($id));
        }
        $smarty->setTpl('app/hptshop/templates/slide_add.html')->display();
        die;
    }
}
//数据删除
if ($_REQUEST['a'] == 'del') {
    $res = $model->del($_POST['id']);
    echo json_encode($res);
    die;
}
//数据列表
$filter['order'] = " ordernum desc ";
示例#2
0
        } else {
            $time_12 = strtotime(date('Y-m-d', $current_time) . ' 12:00:00');
        }
        $time_cha = $time_12 - $current_time;
        $smarty->assign('time_cha', $time_cha);
        $smarty->setLayout('')->setTpl('mobile/templates/detail_lb.html')->display();
    } else {
        $smarty->setLayout('')->setTpl('mobile/templates/detail.html')->display();
    }
}
if ($_REQUEST['a'] == 'index') {
    //获取商品类别
    $cateModel = new Model_ApplistHptShopCate();
    $smarty->assign('cateList', $cateModel->findAll(" id>0 "));
    //获取幻灯片
    $picModel = new Model_ApplistHptShopPic();
    $smarty->assign('picList', $picModel->fetchAll("select * from applist_hpt_shop_pic order by ordernum desc"));
    //数据列表
    $condition = array();
    $url = array();
    $condition[] = " state=2 ";
    //在售
    if ($_GET['keyword']) {
        $condition[] = " name like '%" . common_pg('keyword') . "%' ";
    }
    if ($_GET['cid']) {
        $condition[] = " cid=" . common_pg('cid') . " ";
    }
    if ($condition) {
        $where = implode('and', $condition);
    }