搜索表单

搜索表单

<form method="get" action="{U('search/index/index')}" target="_blank">
<div id="searchtxt" class="searchtxt">
<div class="searchmenu">
<div class="searchselected" id="searchselected">全站</div>
<div class="searchtab" id="searchtab">
<ul>
<li data="0">全站</li>
<li data="1">文章</li>
<li data="2">产品</li>
<li data="3">下载</li>
</ul>
</div>
</div>
<input type="hidden" name="modelid" value="0" id="modelid" />
<input name="q" type="text" placeholder="输入关键字"/>
</div>
<div class="searchbtn">
<button id="searchbtn" type="submit">搜索</button>
</div>
</form>

 

搜索结果(V6.2.7及以上版本)


{w:search field="id,catid,title,updatetime,thumb,url,color,flag,description" keyword="$q" modelid="$modelid" limit="10" page="page"}

<div class="top-title">
<h2>“{$q}” 的搜索结果,共{php echo $tag->total}条</h2>
</div>

{loop $data $v}
{php $v['color_title'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['title']);}
{php $v['description'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['description']);}
<div class="news-list">
<a href="{$v[url]}" class="news-img">
<img src="{get_thumb($v['thumb'])}" alt="{$v[title]}" title="{$v[title]}" />
</a>
<div class="news-right">
{if strstr($v['flag'],'1')}<em>顶</em>{/if} <!-- 内容属性 -->
<a href="{$v[url]}">{$v[color_title]}</a>
<p>{$v[description]}</p>
<div class="news-tags">
{php $tag_data = content_list_tag($v['catid'], $v['id']);}
{loop $tag_data $val}
<a href="{tag_url($val['id'])}" target="_blank" >{$val[tag]}</a>
{/loop}
</div>
</div>
</div>
{/loop}
<div id="page">{$pages}</div>

 

posted @ 2023-08-21 11:18  浅岛连云  阅读(13)  评论(0编辑  收藏  举报