search页面

作者:管理员发布时间:阅读数:72


目前,不管是文章搜索还是商品搜索还是链接搜索都是指向的同一个模板,通过特定的标识区分

{{ define "search.html" }}
<!doctype html>
<html lang="zh-cn">
<head>
{{template "header" .}}
</head>
<body>
{{template "nav" .}}
{{template "bread" .}}
{{if .isArticle}}
<div class="container container_clear pd-10">
<div class="col-md-9">
<div class="panel bg-white pd-5">
<!-- Default panel contents -->
<div class="panel-heading">相关文章</div>
<!-- List group -->
<ul class="list-group">
{{range .articles}}
<li class="list-group-item" style="overflow: hidden;">
<a href="{{.URL}}" class="img-a">
<img src="{{.Img}}" alt="">
</a>
<ul class="cate-right">
<li class="title"><a href="{{.URL}}">{{.Title}}</a></li>
<li><i
class="glyphicon glyphicon-time"></i><span><time>{{.CreatedAt|Time2str}}</time></span><i
class="glyphicon glyphicon-user"></i><span>{{.Auth}}</span>
<i
class="glyphicon glyphicon-folder-open"></i><span>{{ArticleCateName .ArticleCateID}}</span>
</li>
<li class="hidden-xs">{{StrSub .Content 0|Str2html}}</li>
</ul>
</li>
{{end}}
</ul>
<div class="panel-footer">
<nav aria-label="...">
<ul class="pager">
{{if ge 1 .page}}
<li class="disabled"><a href="javascript:;">首页</a></li>
<li class="disabled"><a href="javascript:;">上一页</a></li>
{{else}}
<li><a href="{{.pageURL}}">首页</a></li>
<li><a href="{{.pageURL}}/{{Less .page 1}}">上一页</a></li>
{{end}}

{{if ge .page .pageCount }}
<li class="disabled"><a href="javascript:;">下一页</a></li>
<li class="disabled"><a href="javascript:;">尾页</a></li>
{{else}}
<li><a href="{{.pageURL}}/{{Add .page 1}}">下一页</a></li>
<li><a href="{{.pageURL}}/{{.pageCount}}">尾页</a></li>
{{end}}
</ul>
</nav>
</div>
</div>
</div>

<div class="col-md-3">
{{template "sidebar" .}}
</div>
</div>
{{end}}

{{if .isShop}}
<div class="container container_clear theme pd-10">
{{range .goods}}
<div class="col-md-3 col-xs-6">
<a href="{{.URL}}">
<div class="thumbnail">
<img src="{{.Img}}" alt="{{.Name}}">
<div class="caption">
<p class="text-danger price">¥{{.HotPrice}}</p>
<p>{{.Name}}</p>
</div>
</div>
</a>
</div>
{{end}}
</div>

<nav aria-label="...">
<ul class="pager">
{{if ge 1 .page}}
<li class="disabled"><a href="javascript:;">首页</a></li>
<li class="disabled"><a href="javascript:;">上一页</a></li>
{{else}}
<li><a href="{{.pageURL}}">首页</a></li>
<li><a href="{{.pageURL}}/{{Less .page 1}}">上一页</a></li>
{{end}}

{{if ge .page .pageCount }}
<li class="disabled"><a href="javascript:;">下一页</a></li>
<li class="disabled"><a href="javascript:;">尾页</a></li>
{{else}}
<li><a href="{{.pageURL}}/{{Add .page 1}}">下一页</a></li>
<li><a href="{{.pageURL}}/{{.pageCount}}">尾页</a></li>
{{end}}
</ul>
</nav>
{{end}}

{{if .isLink}}
<div class="container container_clear theme pd-10">
{{range .links}}
<div class="col-md-3 col-xs-6 shop_img">
<a href="{{.URL}}">
<p>{{.Title}}</p>
</a>
</div>
{{end}}

</div>

<nav aria-label="...">
<ul class="pager">
{{if eq 1 .page}}
<li class="disabled"><a href="javascript:;">首页</a></li>
<li class="disabled"><a href="javascript:;">上一页</a></li>
{{else}}
<li><a href="{{.pageURL}}">首页</a></li>
<li><a href="{{.pageURL}}/{{Less .page 1}}">上一页</a></li>
{{end}}

{{if eq .page .pageCount }}
<li class="disabled"><a href="javascript:;">下一页</a></li>
<li class="disabled"><a href="javascript:;">尾页</a></li>
{{else}}
<li><a href="{{.pageURL}}/{{Add .page 1}}">下一页</a></li>
<li><a href="{{.pageURL}}/{{.pageCount}}">尾页</a></li>
{{end}}
</ul>
</nav>
{{end}}


{{template "footer" .}}
{{template "js" .}}
</body>
</html>
{{ end }}