下面这个搜索教程 就可以让我们很快的搜索到对应信息
修改教程如下:
1、打开 \dede\templets\diy_main.htm 找到
在它的下面加入内容列表</div>
<div class="bodytitletxt" style="padding-left:10px;"><form name='form1' action="diy_list.php"><input type='hidden' name='action' value='list' /><input type='hidden' name='diyid' value='<?php echo $diy->diyid; ?>' />关键字:<input type='text' name='keyword' size='20' value="<?php echo $keyword; ?>" /><select name="field"><?phpforeach($fieldlist as $k=>$fielddata){if($k==$field){echo "<option value='{$k}' selected>{$fielddata[0]}</option>\r\n";}else{echo "<option value='{$k}'>{$fielddata[0]}</option>\r\n";}}?></select><input type='submit' name='sb' value='确定' class="coolbg np" /></form></div>
2、打开 \dede\diy_list.php 找到
改成:$query = "SELECT * FROM {$diy->table} ORDER BY id DESC";
if(empty($keyword))
{
$keyword = '';
$addquery = '';
}
else
{
$addquery = " WHERE {$field} LIKE '%".trim($keyword)."%' ";
}
$query = "SELECT * FROM {$diy->table} $addquery ORDER BY id DESC";
继续找到:
在它的下面加入:$datalist->SetParameter('diyid', $diyid);
$datalist->SetParameter('keyword', $keyword);
$datalist->SetParameter('field', $field);
完成。