您现在的位置是:首页 > PHP技术PHP技术
织梦dede后台部分自定义分页,datalist运用实例
2015-08-31【PHP技术】2936 人已围观
简介在dede后台新建一个php文件,写入以下代码 <?php require_once \'include/common.inc.php\'...
在dede后台新建一个php文件,写入以下代码
<?php
require_once \'include/common.inc.php\';
require_once(DEDEINC.\'/datalistcp.class.php\');
//读取留言列表
$dl = new DataListCP();
$dl->pageSize = 10; //设定每页显示记录数(默认25条)
// $dl->SetParameter($key,$value); //设定get字符串的变量
//这两句的顺序不能更换
if(empty($s_tmplets)) {
$s_tmplets = \'/default/message_list.htm\'; //这里引入.htm模版
$tplfile = DEDETEMPLATE.$s_tmplets;
$dl->SetTemplate($tplfile); //载入模板
$sql = \"SELECT * FROM acne_diyform2 where ifcheck=1\"; //自定义
$dl->SetSource($sql); //设定查询SQL
$dl->Display(); //显示
$dl->Close();
}
?>
在对应的模板中写入
{dede:datalist}
< div class=”bottom_ask”>
<p>{dede:field.message/}</p>
</div>
< div class=”bottom_answer”>
<p>{dede:field.reply/}</p>
</div >
{/dede:datalist }
<ul >
{dede:pagelist listsize=\'2\' listitem=\'info index pre pageno next end option\'/}
</ul >
这样就能调用一个自定义后台页面,并且有分页的数据了
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
mysql常见的多表查询语句
select*fromTable1,Table2whereTable1.id=1andTbale2.id-2(是某一相同字段)注意这样的查询...Thinkphp3.1.3中的redirect详解
页面跳转是php编程中常用的方法,今天说说thinkphp3.1.3中的redirect.tp跳转有success和error这二个参数有...Thinkphp5.1 session的使用
某项目小编著电脑本地测试无误,上传到服务器后出现致命错误: Class 'thinkFacadeSession' not...composer安装thinphp5.1的验证码1
按thinkphp5.1开发手机介绍首先需要使用Composer安装think-captcha扩展包,需要fanqiang哦(当然使用国内...