pbootcms在线留言自定义表单制作

PbootCMS系统 admin 644浏览

pbootcms留言表单模板怎么做?登陆网站后台,发现PB在线留言,详情页模板是message.html

操作步骤:

  1. 通过小皮控制面板打开网站根目录:\phpstudy_pro\WWW\www.域名.com\template\default,新建message.html模板
  2. 将下载文件中的在线留言页面代码拷贝粘贴到message.html模板
  3. 修改页面文件调取,将页面所有的static修改为{pboot:sitedomain}/skin
  4. 修改网站标题/关键词/描述调用,TDK代码和pbootcms单页模板一样
  5. 修改网站头部/底部/侧边栏目调用{include file=head.html}{include file=footer.html}{include file=sidebar.html}
  6. 修改面包屑导航{pboot:position separator=>>}栏目名称{sort:name}
  7. 表单中提交的字段名称需要与后台自定义表单中添加的字段一致,否则会导致提交失败;需要更多字段时请在后台自定义表单中新增留言表单字段,然后再在前台新增form字段.
  8. 提交表单,提示"验证码不能为空"怎么解决?全局配置-配置参数-安全配置/留言验证码,选择禁用
<form id="myform1" method="post" action="{pboot:msgaction}">
  <label> <span>你的姓名:</span>
	<input class="inp" type="text" name="name" id="name" placeholder="请输入你的姓名">
  </label>
  <label> <span>联系电话:</span>
	<input class="inp" type="text" name="tel" id="tel" placeholder="请输入你的电话">
  </label>
  <label> <span>电子邮箱:</span>
	<input class="inp" type="email" name="email" id="email" placeholder="请输入你的邮箱">
  </label>
  
  <label class="mes"> <span>留言内容:</span>
	<textarea name="content" id="content"></textarea>
  </label>
  </label>
  <div class="btn-1">
	<input class="focus" type="submit" value="提交" id="tj">
	<input type="reset" value="重置">
  </div>
</form>
<script>
$(function(){
$('#tj').click(function(){
	//alert(1)
	if($('#name').val()==''){alert('请输入您的姓名!'); $("#name").focus(); return false;}
	if ($("#tel").val() == "") { alert("请输入你的手机!"); $("#tel").focus(); return false; } 
	if (!$("#tel").val().match(/^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$/)) { alert("手机号码格式不正确!"); $("#tel").focus(); return false;} 
	if ($("#email").val() == "") { alert("请输入电子邮箱!"); return false; } 
	if (!$("#email").val().match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)) { alert("电子邮箱格式不正确"); $("#email").focus(); return false; } 
	if($('#content').val()==''){alert('请输入留言内容!');return false;}
})
})
</script>

留言板标签

适用范围:全站任意地方均可使用

标签作用:用于用户提交留言和调取留言记录

1、留言提交表单
<form action="{pboot:msgaction}" method="post">
联系人:<input type="text" name="contacts" >
手机:<input type="text" name="mobile" >
内容:<input type="text" name="content" >
验证码:<input type="text" name="checkcode" ><img title="点击刷新" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
<button type="submit">提交</button>
</form>
表单提交方式为post,表单中提交的字段名称需要与后台自定义表单中添加的字段一致,否则会导致提交失败。
需要更多字段时请在后台自定义表单中新增留言表单字段,然后再在前台新增form字段.
标签说明:{pboot:msgaction} 为留言表单接收地址;{pboot:checkcode} 为验证码图片地址

2、留言记录列表
{pboot:message num=*}
<p>[message:contacts]</p>
<p>[message:content]</p>
{/pboot:message}
调取的留言记录默认执行分页,使用内容列表的分页代码即可.
内容隐私,使用截取功能: [message:mobile substr=1,3]****[message:mobile substr=8] 输出效果:187****6563
控制参数:
num=* 数量,非必填,为调取的留言分页大小
page=* 是否分页1或0,非必填,用于关闭分页
lg=* 调取指定语言留言,非必填,设置all则所有语言,不添加该参数则默认为当前语言(V1.3.7+)

补充参考

  1. pbootcms取消后台留言表单验证码的方法

转载请注明:大灰牛博客 » pbootcms在线留言自定义表单制作