<?php require_once (dirname( __FILE__ ). "/include/common.inc.php" ); //载入基础文件 require_once (DEDEINC. "/datalistcp.class.php" ); //载入动态分页类 $dlist = new DataListCP(); //初始化动态列表类 $sql = "select * from zmsys_archives as a right join zmsys_addonarticle as b on a.id=b.aid" ; //查询数据 $dlist ->pageSize=5; //设定每页显示记录数(默认25条) $dl ->SetParameter( $key , $value ); //设定get字符串的变量 $dlist ->SetTemplate(DEDETEMPLATE. '/' . $cfg_df_style . '/list.htm' ); //载入模版 $dlist ->SetSource( $sql ); //设定查询SQL $dlist ->Display(); //显示 ?> |
2.新建list.htm模板文件
1
2
3
4
5
6
7
8
9
|
< ul id = "list" > {dede:datalist} < li > < a href = "#" >< img src = "{dede:field.litpic/}" /></ a > < a href = "#" >{dede:field.title/}</ a > </ li > {/dede:datalist} </ ul > {dede:pagelist listsize='2' listitem='info index pre pageno next end option'/} |