1 Star 0 Fork 0

robinnode/OrchardDoc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Search.cshtml 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
@using App_Code
@{
var q = Request.QueryString["q"];
var page = int.Parse(Request.QueryString["p"] ?? "1");
Page.Title = "Orchard Documentation - Search - " + q;
Page.DocumentTitle = "Search Results";
var resultSet = SearchHelpers.Query(HttpContext.Current, q, page);
var documents = resultSet.Documents;
if (resultSet.TotalCount == 0) {
@:No results found.
}
else {
<div class="searchResultCount">@resultSet.TotalCount @(resultSet.TotalCount > 1 ? "documents" : "document") found.</div>
<ul id="SearchResultsDiv">
@foreach (var doc in documents) {
<li>
<article>
<header>
<h2><a href="@Href(doc.Url)">@doc.Title</a></h2>
</header>
<blockquote>@Html.Raw(doc.Summary)</blockquote>
<div><a href="@Href(doc.Url)">Read more...</a></div>
</article>
</li>
}
</ul>
if (resultSet.TotalCount > SearchHelpers.PageSize) {
int pages = (resultSet.TotalCount / SearchHelpers.PageSize) + 1;
<ul class="searchPagination">
@for (var p = 1; p <= pages; p++) {
<li>@if (p == page) {<text>@p</text>} else {<a href="?q=@(q)&p=@p">@p</a>}</li>
}
</ul>
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/robinnode/OrchardDoc.git
[email protected]:robinnode/OrchardDoc.git
robinnode
OrchardDoc
OrchardDoc
master

搜索帮助