留言板标签
留言板标签用于展示留言表单和提交留言。
留言表单
post {soeay:msgaction}
<form action="{soeay:msgaction}" method="post">
{soeay:csrf_field}
<input type="text" name="name" placeholder="姓名" required>
<input type="tel" name="mobile" placeholder="手机" required>
<input type="email" name="email" placeholder="邮箱">
<textarea name="content" placeholder="留言" required></textarea>
{soeay:if('{soeay:checkcodestatus}'=='1')}
<img src="{soeay:checkcode}" alt="验证码" onclick="this.src=this.src+'?'+Math.random()">
<input type="text" name="checkcode" placeholder="验证码">
{/soeay:if}
<button type="submit">提交留言</button>
</form>相关标签
| 标签 | 说明 |
|---|---|
| {soeay:msgaction} | 留言提交地址 /message |
| {soeay:csrf_field} | CSRF安全字段 |
| {soeay:checkcodestatus} | 验证码开关状态,1=开启 |
| {soeay:checkcode} | 验证码图片URL |
留言列表
使用{soeay:message}块标签可在前台展示已审核的留言列表,常用于留言板页面。
{soeay:message num=10 order=id dir=desc}
<div class="message-item">
<p>联系人:[soeay:contacts]</p>
<p>手机:[soeay:mobile]</p>
<p>留言内容:[soeay:content]</p>
<p>时间:[soeay:create_time]</p>
</div>
{/soeay:message}| 属性 | 说明 | 默认值 |
|---|---|---|
| num | 显示数量 | 10 |
| order | 排序字段,支持 id / create_time | id |
| dir | 排序方向,asc / desc | desc |
留言列表可用变量
| 变量 | 说明 |
|---|---|
| [soeay:id] | 留言ID |
| [soeay:contacts] | 联系人 |
| [soeay:mobile] | 手机 |
| [soeay:content] | 留言内容 |
| [soeay:create_time] | 提交时间 |
| [soeay:i] / [soeay:num] | 循环序号 |
使用场景
- 在「联系我们」或独立留言页面中放置留言表单。
- 在留言板页面中循环展示已审核留言。
- 建议配合验证码开关判断,避免在关闭验证码时仍显示验证码输入框。
