ecshop中自定义页面的分页实现使用ecs自带分页程序

来源:互联网 发布:飞鹰网络电视手机版 编辑:程序博客网 时间:2024/05/21 21:01
/*------------------------------------------------------ */
//-- 商铺服务列表
/*------------------------------------------------------ */

if ($_REQUEST['act'] == 'list')
{
    /* 检查权限 */
    admin_priv('shop_service');
    //包含分页方法
    $sql = "SELECT COUNT(*) FROM  " . $ecs->table('shop_service') . " where status=1";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    $sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
    set_filter($filter, $sql);
    $rs = $GLOBALS['db']->getAll($sql);
    foreach($rs as $k=>$v){
        if($v['list_page_img'] != ''){
            $rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
        }else{
            $rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
        }
    }
    $lists = array('shop_service_list' => $rs, 'filter' => $filter,
        'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
        $smarty->assign('shop_service_list',    $lists['shop_service_list']);
    $smarty->assign('filter',       $lists['filter']);
    $smarty->assign('record_count', $lists['record_count']);
    $smarty->assign('page_count',   $lists['page_count']);
    $smarty->assign('full_page',    1);
    $smarty->display('shop_service_list.htm');
}
elseif ($_REQUEST['act'] == 'query'){
    $sql = "SELECT COUNT(*) FROM  " . $ecs->table('shop_service') . " where status=1";
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    $sql = "SELECT a.id as service_id,a.user_id,a.option_id,a.service_name,a.market_price,a.promote_price,a.list_page_img,from_unixtime(a.create_time) as create_time,a.service_count,a.type,b.shop_mobile_phone,b.truename,c.option_name,d.type_name,e.img_url as list_page_img FROM ".$ecs->table('shop_service')." as a left join ecs_business_service_join as b on a.user_id=b.user_id left join ecs_service_option as c on a.option_id=c.id left join ecs_join_shop_type as d on b.shop_type=d.id left join ecs_user_pic as e on a.list_page_img=e.id where a.status=1 order by a.create_time LIMIT " . $filter['start'] . ',' . $filter['page_size'];
    set_filter($filter, $sql);
    $rs = $GLOBALS['db']->getAll($sql);
    foreach($rs as $k=>$v){
        if($v['list_page_img'] != ''){
            $rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . $v['list_page_img'];
        }else{
            $rs[$k]['list_page_img'] = SITE_URL . 'Public/uploads/' . 'default.png';
        }
    }
    $lists = array('shop_service_list' => $rs, 'filter' => $filter,
        'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
    $smarty->assign('shop_service_list',    $lists['shop_service_list']);
    $smarty->assign('filter',       $lists['filter']);
    $smarty->assign('record_count', $lists['record_count']);
    $smarty->assign('page_count',   $lists['page_count']);
    $smarty->assign('full_page',    1);
    make_json_result($smarty->fetch('shop_service_list.htm'), '', array('filter' => $lists['filter'], 'page_count' => $lists['page_count']));
}
0 0
原创粉丝点击