Example #1
0
    }
    echo json_encode($res);
    die;
}
//数据列表
$cateList = $cateModel->dataArr();
foreach ($cateList as $v) {
    $cateRow[$v['id']] = $v['name'];
}
$condition = array();
if ($_GET['keywords']) {
    $condition[] = " name like '%" . common_pg('keywords') . "%' ";
}
if ($_GET['cid']) {
    $condition[] = " cid=" . common_pg('cid') . " ";
}
if ($condition) {
    $filter['where'] = implode('and', $condition);
}
$filter['order'] = " id desc ";
$data = $model->paginate($filter, '*', common_pg('p'), 10);
$listArr = $data['data'];
foreach ($listArr as $key => $value) {
    $listArr[$key]['s_name'] = cut_str(deletehtml($value['name']), 6);
    $listArr[$key]['cname'] = $cateRow[$value['cid']];
}
//获取商品类别
$smarty->assign('cateList', $cateList);
$smarty->assign('list', $listArr);
$smarty->assign('page', $model->pager($data['pager']));
$smarty->setTpl('shop/templates/goods_index.html')->display();
Example #2
0
    //管理员头像
    $uRow = D('sub_user')->find(1);
    $data['info']['head_pic'] = '/data/image_c/' . $uRow['head_pic'];
    $data['info']['tid'] = (int) $_POST['tid'];
    $data['info']['content'] = str_inmysql($_POST['content']);
    $data['info']['name'] = '云姐';
    $res = $replyTable->add($data);
    if ($res) {
        echo json_encode($res);
    }
    exit;
}
//数据删除
if ($_GET['action'] == 'del') {
    $id = (int) $_GET['id'];
    $res = $replyTable->del($id);
    echo json_encode($res);
    exit;
}
//根据ID查询帖子信息
$id = (int) $_GET['id'];
$vo = $postTable->find($_GET['id']);
//回复列表
$filter['where'] = " tid=" . $id;
$filter['order'] = " id desc ";
$data = $replyTable->paginate($filter, '*', $_GET['p'], 5);
//分页信息
$smarty->assign('page', $replyTable->pager($data['pager']));
$smarty->assign('vo', $vo);
$smarty->assign('replyArr', $data['data']);
$smarty->setTpl('task/templates/bbs_manage.html')->display();