ECMS 6.6/搜索表单制作

来自站长百科
跳转至: 导航、​ 搜索

ECMS 6.6| 安装| 使用| 升级与整合| 新版解密教程|模板标签说明|二次开发| FAQ

搜索表单制作[ ]

帝国CMS内置强大的搜索功能,用户只需制作搜索表单指向搜索处理页面即可实现相应搜索。本文讲解:搜索表单制作语法。

Searchform11.jpg

Searchform12.jpg


单条件搜索表单制作范例[ ]

一、表单范例1:

Dreamweaver制作好表单:[ ]

设计视图:

Searchform1.gif

代码模式下的表单代码

<table width="320" border="0" cellspacing="1" cellpadding="3">
<form name="searchform" method="post" action="/e/search/index.php">
    <tr>
      <td>关键字:<input name="keyboard" type="text" size="10"></td>
      <td>范围:
        <select name="show">
          <option value="title">标题</option>
          <option value="smalltext">简介</option>
          <option value="newstext">内容</option>
          <option value="writer">作者</option>
          <option value="title,smalltext,newstext,writer">搜索全部</option>
        </select></td>
    </tr>
    <tr>
      <td>栏 目:
        <select name="classid">
          <option value="0">搜索全部</option>
          <option value="1">新闻中心</option>
          <option value="4">技术文档</option>
          <option value="22">下载中心</option>
        </select> </td>
      <td><input type="submit" name="submit" value="搜索"></td>
    </tr>
</form>
</table>

最终搜索表单显示效果为下图:[ ]

Searchform2.gif

搜索表单多条件并列搜索语法说明[ ]

多字段、多逻辑运算联结符并列搜索

(一)、多字段并列搜索:有“字符串”与“数组”两种传递方式

  1. 字符串传递为例子:
    <input type="hidden" name="hh" value="LK">
    <input type="hidden" name="show" value="title,writer">
    <input type="hidden" name="keyboard" value="标题,作者">
    说明:上面为模糊查询title字段包含“标题”字符或者writer字段包含“作者”的信息
  2. 数组传递为例子:
    <input type="hidden" name="hh" value="LK">
    <input type="hidden" name="show[]" value="title">
    <input type="hidden" name="keyboard[]" value="标题">
    <input type="hidden" name="show[]" value="writer">
    <input type="hidden" name="keyboard[]" value="作者">
    说明:上面为模糊查询title字段包含“标题”字符或者writer字段包含“作者”的信息

(二)、多逻辑运算联结符并列搜索

  1. 字符串传递为例子:
    <input type="hidden" name="hh" value="LK,EQ">
    <input type="hidden" name="show" value="title,writer">
    <input type="hidden" name="keyboard" value="标题,作者">
    说明:上面为模糊查询title字段包含“标题”字符或者writer字段等于“作者”的信息
  2. 字符串传递为例子:
    <input type="hidden" name="show[]" value="title">
    <input type="hidden" name="hh[]" value="LK">
    <input type="hidden" name="keyboard[]" value="标题">
    <input type="hidden" name="show[]" value="writer">
    <input type="hidden" name="hh[]" value="EQ">
    <input type="hidden" name="keyboard[]" value="作者">
    说明:上面为模糊查询title字段包含“标题”字符或者writer字段等于“作者”的信息

多条件并列搜索的表单制作范例[ ]

二、表单范例2:实现按标题、作者、录入者与信息ID同时搜索的表单

1、用Dreamweaver制作好表单:

设计视图:

Searchform3.gif

代码模式下的表单代码

Searchform4.gif

上面例子html代码

<form name="searchform" method="post" action="/e/search/index.php">
  <table width="550" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <input type="hidden" name="tbname" value="news">
    <input type="hidden" name="tempid" value="1">
    <input type="hidden" name="andor" value="and">
    <tr class="header"> 
      <td colspan="2">新闻搜索</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="97">标题:</td>
      <td width="388"> 
          <input type="hidden" name="show[]" value="title">
          <input type="hidden" name="hh[]" value="LK">
          <input name="keyboard[]" type="text">
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>作者:</td>
      <td> 
          <input type="hidden" name="show[]" value="writer">
          <input type="hidden" name="hh[]" value="LK">
          <input name="keyboard[]" type="text">
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>录入者:</td>
      <td> 
          <input type="hidden" name="show[]" value="username">
          <input type="hidden" name="hh[]" value="EQ">
          <input name="keyboard[]" type="text">
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>信息ID范围:</td>
      <td> 
          <input type="hidden" name="show[]" value="id">
          <input type="hidden" name="hh[]" value="BT">
          <input name="keyboard[]" type="text">
        <font color="#666666">(例:“1 6”表示1到6之间) </font>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td> </td>
      <td> 
        <input type="submit" name="Submit" value="马上搜索">
        <font color="#666666">(不设置为不限)</font>
      </td>
    </tr>
  </table>
</form>

2、最终搜索表单显示效果为下图:

Searchform5.gif

参考来源[ ]

ECMS 6.6使用手册导航

安装:

ECMS 6.6 安装

使用:

ECMS建站流程|后台菜单介绍|前台菜单介绍|专业术语介绍|后台栏目管理|后台信息管理|后台专题管理|其他管理操作|采集管理|插件管理|管理员后台操作|管理员后台其他操作管理|后台用户管理|后台会员管理|系统安全设置

升级与整合

打通多个帝国CMS系统的会员整合与同步教程|整合Ucenter接口教程|整合Discuz通行证接口教程|整合PHPwind通行证接口教程|万能会员接口|论坛通行证接口|会员数据从文本文件导入帝国CMS的插件

新版解密教程

教程模型使用相关解密教程|教程模板使用相关解密教程|管理相关解密教程

模板标签说明

网站模板说明|其他模板说明|调用标签使用说明

二次开发

系统目录结构|常用函数介绍|扩展SQL程序编写介绍|插件二次开发格式建议|显示“Hello,world”|显示最新10条新闻|分类信息分页列表

FAQ

ECMS 6.6 FAQ