帝国cms 7.5 搜索框 *搜索、*搜索
孤峰
孤峰家
2023-05-30
177人阅读
帝国cms跟dede哪个好
一、根据数据表搜索:
<form action="/e/search/index.php" method="post" name="searchform" id="searchform">
<input type="hidden" name="show" value="title,newstext">
<input type="hidden" name="tempid" value="1">
<input name="keyboard" type="text" id="keyboard">
<select name="tbname">
<option value="news">问题库</option>
<option value="downl">视频教程</option>
</select>
<input type="submit" name="submit" value="搜索">
</form>
Show:搜索字段变量(多个字段用","隔开。搜索字段必须是后台系统模型开启搜索项的字段)
Tempid:所用搜索模板ID(一般跟按表搜索结合使用)
Keyboard:搜索关键字变量
Tbname:按数据表搜索(需与搜索模板ID结合Tempid)
二、根据栏目id搜索:
<form name="searchform" method="post" action="/e/search/index.php">
<input type="hidden" name="show" value="title,newstext">
<input name="keyboard" type="text" size="10">
<select name="classid">
<option value="1">原创教程</option>
<option value="2">教程笔记</option>
<option value="3">软件插件</option>
<option value="4">问题记录</option>
<option value="5">摄影作品</option>
</select>
<input type="submit" name="submit" value="搜索">
</form>
//Show:搜索字段变量(多个字段用","隔开。搜索字段必须是后台系统模型开启搜索项的字段)
//Keyboard:搜索关键字变量
//Classid:搜索栏目ID(不设置为不限,多个栏目可用","隔开,设置父栏目会搜索所有子栏目)
三、搜索代码
<form action="[!--news.url--]e/search/index.php" method="post" name="searchform" id="searchform">
<input name="keyboard" id="keyboard" class="input_text" value="请输入关键字词" style="color: rgb(153, 153, 153);" onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}" onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}" type="text">
<input name="show" value="title" type="hidden">
<input name="tempid" value="1" type="hidden">
<input name="tbname" value="news" type="hidden">
<input name="Submit" class="input_submit" value="搜索" type="submit">
</form>
四、有多个模型的搜索代码
<div class="search">
<form action="[!--news.url--]e/search/index.php" method="post" name="searchform" id="searchform">
<input name="keyboard" id="keyboard" class="input_text" value="请输入关键字词" style="color: rgb(153, 153, 153);" onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}" onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}" type="text">
<input name="show" value="title" type="hidden">
<input name="tempid" value="1" type="hidden">
<select name="tbname">
<option value="article">杂志</option>
<option value="news">文章</option>
</select>
<input name="Submit" class="input_submit" value="搜索" type="submit">
</form>
</div>
五、*搜索搜索代码
*搜索表单语法说明:
1、*搜索表单语法说明:
搜索表单提交地址:/e/sch/index.php
表单提交方式用:GET
keyboard:搜索关键字变量(前台搜索多个关键字可以用空格隔开)。
field:搜索字段变量,0为按后台设置搜索;1为按全文搜索;2为按标题搜索;3为按内容搜索。
classid:指定要搜索的栏目ID,多个栏目ID用逗号隔开。
2、表单范例:
<div class="search">
<form action="[!--news.url--]e/sch/index.php" method="get" name="searchform" id="searchform">
<input name="keyboard" id="keyboard" class="input_text" value="请输入关键字词" style="color: rgb(153, 153, 153);" onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}" onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}" type="text">
<input name="show" value="title,picsay,newstext,*alltext" type="hidden">
<input name="tempid" value="0" type="hidden">
<input name="tbname" value="news,photo" type="hidden">
<input name="Submit" class="input_submit" value="搜索" type="submit">
</form>
</div>
六、*搜索搜索代码对应的模板是"公共模板"-“*搜索模板”
<div class="weizhi">您当前的位置:系统搜索到约有[!--num--]项符合[!--keyboard--]的查询结果</div>
<div class="news_search">
<h2>搜索结果</h2>
<ul class="search_news">
[!--empirenews.listtemp--]
<li>[!--no.num--]. <a href="[!--titleurl--]" target="_blank">
<h2>[!--title--]</h2>
</a>
<p class="search_text">[!--smalltext--]</p>
<p class="search_info"><span>[!--titleurl--] - [!--newstime--]</span></p>
</li>
[!--empirenews.listtemp--]
</ul>
<div class="epages">[!--listpage--]</div>
</div>
案例展示,根据自己的需求设置css样式;
<form class="searchform " method="GET" action="[!--news.url--]e/sch/index.php"style="width:220px;max-width:*;" name="search_news" onsubmit="return searchResult(this);" target="_blank">
<input type="text" style="border:1px solid #000000;color:#000000;font-size:12px;line-height:14px;padding-top:px;padding-bottom:px;height:37px;" name="keyboard" id="form_search" value="" placeholder="搜索学习需要学习的关键词">
<input type="hidden" name="tbname" value="news">
<input type="hidden" name="show" value="title">
<input type="hidden" name="tempid" value="1">
<input type="submit" class="assistive-text searchsubmit" value="Go!">
<a href="#go" style="width:auto;line-height: 37px;height: 37px;background: #000000 none repeat scroll 0 0;border: 0 none;border-radius: 0;color: #8d9095;cursor: pointer;font-size: 12px;font-weight: normal;margin: 0;padding: 0px 10px ;text-indent: 0;text-shadow: none;transition: all 0.2s ease 0s;right: 0;top:0px;" class="submit fa fa-search"></a>
</form>
很赞哦! ()
转载:感谢您阅览帝国cms跟dede哪个好,转载请注明文章出处“来源从小爱孤峰知识网:一个分享知识和生活随笔记录的知识小站”。
链接:帝国cms 7.5 搜索框 *搜索、*搜索http://www.gufeng7.com/diguocms/186.html
联系:如果侵犯了你的权益请来信告知我们删除。邮箱:119882116@qq.com
上一篇: 帝国cms搜索页面模板
下一篇: 帝国cms如何制作xml网站地图?