zoukankan      html  css  js  c++  java
  • 织梦dede自定义内容分页,datalist运用实例

    在/plus文件夹中新建一个ceshi.php文件。。
    <?php
     require(dirname(__FILE__)."/../include/common.inc.php");
     require_once(DEDEINC.'/datalistcp.class.php');
     //读取留言列表
     $dl = new DataListCP();
     $dl->pageSize = 10;              //设定每页显示记录数(默认25条)
     //$dl->SetParameter(typeid,$typeid);    //设定get字符串的变量  $typeid就是传递值
     //这两句的顺序不能更换
     if(empty($s_tmplets)) {
         $s_tmplets = '/plus/ceshilist.htm';
         $tplfile = DEDETEMPLATE.$s_tmplets;
         $dl->SetTemplate($tplfile);      //载入模板
         $sql = "SELECT * FROM `#@__archives`"; //自定义 传递值加载条件内where typeid=".$typeid
         $dl->SetSource($sql);            //设定查询SQL
         $dl->Display();                  //显示
         $dl->Close();
         }
    ?>


    新建模板  /templets/plus/ceshilist.htm
    在对应的模板中写入
    {dede:datalist}
    <li><a target="_blank" title="{dede:field.fulltitle/}" href="http://blog.163.com/pepsl@126/blog/{dede:field.arcurl/}">{dede:field.title/}</a></li>
    {/dede:datalist}
    <ul  >
    {dede:pagelist listsize='2' listitem='info index pre pageno next end option'/}
    </ul  >

    这样就能调用一个表单,并且有分页的数据了
    测试访问:自己的网址/plus/ceshi.php
  • 相关阅读:
    nyoj 463-九九乘法表
    nyoj 458-小光棍数 (471)
    nyoj 457-大小写互换
    nyoj 455-黑色帽子
    nyoj 412-Same binary weight (bitset ,to_ulong())
    nyoj 399-整除个数 (整除)
    nyoj 366-D的小L (next_permutation())
    nyoj 324-猴子吃桃问题 (m[i] = (m[i-1] + 1) * 2)
    nyoj 283-对称排序 (sort)
    HBase 在人工智能场景的使用
  • 原文地址:https://www.cnblogs.com/wanshutao/p/4548548.html
Copyright © 2011-2022 走看看