💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# guestbook 留言(表单)标签(废弃) ## 留言模型(表单)标签 用于获取在后台创建的留言表单输出到前台 > v2.2.1.20220603 版本起不在使用该标签 ## 参数 参数名称可选值默认值是否必填说明id-item-指定循环里的变量名,例如id='obj',模板调用如:{$item.action} 变成 {$obj.action}catid--是栏目ID,也可传入变量captcha1--验证码,1-开启验证码cache-3600秒-缓存时间,默认3600秒## 参数说明 - id,指定循环里的变量名,id="obj",如下 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>guestbook catid<span class="token">=</span><span class="token4">"34"</span> id<span class="token">=</span><span class="token4">"obj"</span><span class="token1">}</span> <span class="token5">// 默认是$item,field的值来自于您创建的模型字段参考下图</span> <span class="token"><</span>input type<span class="token">=</span><span class="token4">"text"</span> class<span class="token">=</span><span class="token4">"form-control"</span> name<span class="token">=</span><span class="token4">"{$obj.field.name|default=''}"</span> <span class="token">/</span><span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>guestbook<span class="token1">}</span> ``` ``` ![](https://img.kancloud.cn/81/e5/81e5cfd2e1a73efdad172f1e64c19275_789x405.png) - catid,留言栏目ID,**必填** - captcha,验证码,值为1就是开启验证码,其中的catid可以以传入变量,例如每个栏目页会有$Cate栏目变量,写法:`catid="$Cate['id']"` 或 `catid="$Cate.id"` ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>guestbook catid<span class="token">=</span><span class="token4">"34"</span> captcha<span class="token">=</span><span class="token4">"1"</span><span class="token1">}</span> <span class="token"><</span>form action<span class="token">=</span><span class="token4">"{$item.action}"</span> method<span class="token">=</span><span class="token4">"post"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"row g-2 mb-3"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md-4"</span><span class="token">></span> <span class="token"><</span>input class<span class="token">=</span><span class="token4">"form-control"</span> id<span class="token">=</span><span class="token4">"captcha"</span> name<span class="token">=</span><span class="token4">"{$item.captcha.field}"</span> <span class="token">/</span><span class="token">></span> <span class="token"><</span>label <span class="token2">for</span><span class="token">=</span><span class="token4">"content"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">'Verify code'</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md-2"</span><span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:changeVer();"</span><span class="token">></span> <span class="token"><</span>img id<span class="token">=</span><span class="token4">"captcha-img"</span> src<span class="token">=</span><span class="token4">"{$item.captcha.url}"</span> data<span class="token">-</span>url<span class="token">=</span><span class="token4">"{$item.captcha.url}"</span><span class="token">></span> <span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>button type<span class="token">=</span><span class="token4">"submit"</span> class<span class="token">=</span><span class="token4">"btn btn-primary"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">"Submit"</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>button<span class="token">></span> <span class="token"><</span><span class="token">/</span>form<span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>guestbook<span class="token1">}</span> ``` ``` ## 完整示例 ``` <pre class="calibre16">``` <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-xl-12 my-3"</span><span class="token">></span> <span class="token1">{</span><span class="token5">//captcha=1,开启验证码之后在下面自定义验证码表单}</span> <span class="token1">{</span>hkcms<span class="token1">:</span>guestbook catid<span class="token">=</span><span class="token4">"34"</span> captcha<span class="token">=</span><span class="token4">"1"</span><span class="token1">}</span> <span class="token1">{</span><span class="token5">// 获取栏目名称}</span> <span class="token"><</span>h5 class<span class="token">=</span><span class="token4">"my-3"</span><span class="token">></span><span class="token1">{</span>$item<span class="token1">[</span><span class="token4">'category'</span><span class="token1">]</span><span class="token1">[</span><span class="token4">'title'</span><span class="token1">]</span><span class="token">?</span><span class="token">?</span><span class="token4">''</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>h5<span class="token">></span> <span class="token1">{</span><span class="token5">// 请求地址}</span> <span class="token"><</span>form action<span class="token">=</span><span class="token4">"{$item.action}"</span> method<span class="token">=</span><span class="token4">"post"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"row g-2 mb-3"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"form-floating"</span><span class="token">></span> <span class="token"><</span>input type<span class="token">=</span><span class="token4">"text"</span> class<span class="token">=</span><span class="token4">"form-control"</span> name<span class="token">=</span><span class="token4">"{$item.field.name|default=''}"</span> id<span class="token">=</span><span class="token4">"name"</span><span class="token">></span> <span class="token"><</span>label <span class="token2">for</span><span class="token">=</span><span class="token4">"name"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">'Name'</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"form-floating"</span><span class="token">></span> <span class="token"><</span>input type<span class="token">=</span><span class="token4">"text"</span> class<span class="token">=</span><span class="token4">"form-control"</span> name<span class="token">=</span><span class="token4">"{$item.field.phone|default=''}"</span> id<span class="token">=</span><span class="token4">"phone"</span><span class="token">></span> <span class="token"><</span>label <span class="token2">for</span><span class="token">=</span><span class="token4">"phone"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">'Telephone'</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"row g-2 mb-3"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"form-floating"</span><span class="token">></span> <span class="token"><</span>textarea class<span class="token">=</span><span class="token4">"form-control"</span> id<span class="token">=</span><span class="token4">"content"</span> name<span class="token">=</span><span class="token4">"{$item.field.content|default=''}"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>textarea<span class="token">></span> <span class="token"><</span>label <span class="token2">for</span><span class="token">=</span><span class="token4">"content"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">'Content'</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"row g-2 mb-3"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md-4"</span><span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"form-floating"</span><span class="token">></span> <span class="token"><</span>input class<span class="token">=</span><span class="token4">"form-control"</span> id<span class="token">=</span><span class="token4">"captcha"</span> name<span class="token">=</span><span class="token4">"{$item.captcha.field}"</span> <span class="token">/</span><span class="token">></span> <span class="token"><</span>label <span class="token2">for</span><span class="token">=</span><span class="token4">"content"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">'Verify code'</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>label<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>div class<span class="token">=</span><span class="token4">"col-md-2"</span><span class="token">></span> <span class="token"><</span>a href<span class="token">=</span><span class="token4">"javascript:changeVer();"</span><span class="token">></span><span class="token"><</span>img id<span class="token">=</span><span class="token4">"captcha-img"</span> src<span class="token">=</span><span class="token4">"{$item.captcha.url}"</span> data<span class="token">-</span>url<span class="token">=</span><span class="token4">"{$item.captcha.url}"</span> style<span class="token">=</span><span class="token4">"width: 180px"</span><span class="token">></span><span class="token"><</span><span class="token">/</span>a<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> <span class="token"><</span>button type<span class="token">=</span><span class="token4">"submit"</span> class<span class="token">=</span><span class="token4">"btn btn-primary"</span><span class="token">></span><span class="token1">{</span><span class="token1">:</span><span class="token6">lang</span><span class="token1">(</span><span class="token4">"Submit"</span><span class="token1">)</span><span class="token1">}</span><span class="token"><</span><span class="token">/</span>button<span class="token">></span> <span class="token"><</span><span class="token">/</span>form<span class="token">></span> <span class="token1">{</span><span class="token">/</span>hkcms<span class="token1">:</span>guestbook<span class="token1">}</span> <span class="token"><</span><span class="token">/</span>div<span class="token">></span> ``` ``` ## 数据字典 键名值说明action请求地址field数组放入表单name里面,请求的参数名all数组所有留言板字段category数组栏目信息captcha数组,包含url,field验证码