您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程

ecshop分页调用写法

夏彤2025-02-06Ecshop商城教程已有人查阅

导读ecshop分页是ajax请求的,必须在主文件里有个act=query处理,分页会请求这个act

ecshop分页是ajax请求的,必须在主文件里有个act=query处理,分页会请求这个act
<?php
//获取列表
if($_REQUEST['act']=='list'){
//权限设置
admin_priv('issued_invite_code');
$res = get_list();
$smarty-> assign('list',$res['list']);
$smarty-> assign('filter', $res['filter']);
$smarty-> assign('record_count', $res['filter']['record_count']);
$smarty-> assign('page_count', $res['filter']['page_count']);
assign_query_info();
$smarty->display('aa.html');
}
//分页ajax查询
if($_REQUEST['act'] == 'query'){
admin_priv('issued_invite_code');
$list = get_list();
$smarty-> assign('list',$res['list']);
$smarty-> assign('filter', $res['filter']);
$smarty-> assign('record_count', $res['filter']['record_count']);
$smarty-> assign('page_count', $res['filter']['page_count']);
$smarty->assign('is_ajax' ,true);
assign_query_info();
make_json_result($smarty->fetch('aa.html'), '',
array('filter' => $res['filter'], 'page_count' => $res['filter']['page_count']));
}
function get_list(){
$filter['record_count'] = $GLOBALS['db']->getOne("select count(*) from aa");
$filter = page_and_size($filter);
$sql = "select * from aa LIMIT $filter[start] , $filter[page_size]";
$list = $GLOBALS['db']-> getAll($sql);
return array('list'=>$list,'filter'=>$filter);
}
?>
{insert_scripts files="jquery.js,jquery.json.js,../js/transport.js,common.js"} //引入 必要的js
{insert_scripts files="../js/utils.js,listtable.js"} //引入 listtable.js
{if !$is_ajax} //如果是ajax分页就不显示表头
<h2 class="go-list">下发记录</h2>
{/if}
<div class="list-div" id="listDiv">
<table cellpadding="3" cellspacing="1">
<tr>
<th>id</th>
<th>名称</th>
</tr>
{if $list}
{foreach from=$list item=data}
<tr>
<td style="background-color: rgb(255, 255, 255);text-align: center;">{$data.id}</td>
<td style="background-color: rgb(255, 255, 255);text-align: center;">{$data.name}</td>
</tr>
{/foreach}
{else}
<tr>
<td>记录为空</td>
</tr>
{/if}
</table>
<table cellpadding="4" cellspacing="0">
<tr>
<td align="right">{include file="page.htm"}</td> //引入分页模板
</tr>
</table>
</div>

本文标签:

很赞哦! ()

相关源码

  • 宽屏自适应搬家家政快递物流公司网站模板该宽屏大气的响应式网站模板专为搬家公司、家政服务及物流快递企业设计,基于PbootCMS内核开发,通过自适应布局确保手机、PC等多终端体验一致,助力企业高效构建专业在线服务平台。查看源码
  • (自适应)居家生活日用品纸盘纸盒纸杯卫生纸巾生产厂家pbootcms模板为纸品生产企业打造的现代化展示平台,自动适应各种设备屏幕,确保浏览体验一致,完善的SEO功能,提升网站曝光度,基于PbootCMS构建,源码开放可定制。查看源码
  • (PC+WAP)门窗门业家居定制铝合金产品pbootcms模板下载基于PbootCMS内核开发的门窗门业企业专用模板,采用响应式设计结构,数据一次录入即可同步适配电脑与手机端浏览。通过简洁大气的视觉呈现,帮助门窗企业快速建立专业线上展示平台,有效传递产品价值与服务优势。查看源码
  • 帝国cms7.5奇闻异事末解之谜模板免费下载带数据本模板基于帝国CMS7.5系统开发,为神秘现象、未解之谜类主题网站设计。包含完整的PC端、移动端及百度MIP站同步生成功能,内置火车头采集规则模块,可快速采集目标站内容资源。整体设计风格神秘大气,符合主题定位。查看源码
  • (自适应)HTML5响应式双语绿色物流运输快递货运pbootcms源码本款基于PbootCMS开发的网站模板为物流运输、快递货运行业设计,采用HTML5技术构建,支持简繁字体切换。模板设计充分考虑了货运物流行业的特点,可专业展示运输服务、物流网络和业务优势等内容。查看源码
  • 粉色家政月嫂保姆公司pbootcms网站模板(PC+WAP)为家政服务、月嫂保姆企业打造的营销型解决方案,基于PbootCMS内核开发,采用温馨粉色主题传递行业温度。PHP7.0+高性能架构支持SQLite/MySQL双数据库查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐