创新屋百科网

您现在的位置是:首页 > 站长新闻 > CMS教程 > 正文

CMS教程

织梦dedecms自定义表单前台调用显示+分页调用

达特2023-03-02CMS教程223

我们用织梦做网站,网站中需要展示提交的表单,就需要表单的前台调用,通过二次开发来实现

在根目录建立form.php

1
2
<?phprequire_once('/include/common.inc.php');require_once(DEDEINC.'/datalistcp.class.php');
  $sql = "Select * From `dede_diyform1`";//可以接着加条件 例如order by id desc 排序$dlist = new DataListCP();$dlist->SetTemplet("templets/plus/form.htm");$dlist->SetSource($sql);$dlist->display();?>

templets/plus 目录下新建form.htm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{dede:config.pagesize value='5'/}<!--这里设置每页显示的条数www.lol9.cn六久阁织梦模板-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>自定义表单</title>
</head>
<body>
<ul>
{dede:datalist}
<li>{dede:field.name /}-----{dede:field.sex /}<li>
{/dede:datalist}
</ul>
{dede:pagelist listsize=5/}
</body>
</html>

{dede:field.name /}和{dede:field.sex /}  根据你自己的自定义表单字段来填写.


发表评论

评论列表

  • 这篇文章还没有收到评论,赶紧来抢沙发吧~