- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearch.vbhtml
More file actions
Latest commit
119 lines (113 loc) · 5.94 KB
/
Copy pathSearch.vbhtml
File metadata and controls
119 lines (113 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@Code
' Handle user request to swap theme
IfNotRequest.QueryString("Theme")IsNothingThen
DimswapToAsString=Request.QueryString("Theme")
InitializeApplication.SwapTheme(swapTo)
EndIf
' set page properties
Layout=Helpers.SetTheme().ToString
PageData("Title")=HttpContext.Current.Application("SearchTitle")
' Get search query or set default if empty.
DimsearchQueryAsString=ApplicationSecurity.ValidateInput(Request.QueryString("Query"))
DimsearchedForAsString=searchQuery
IfsearchQuery=""ThensearchQuery="QXYZ"
' Configure datasource connection
DimuserDatabaseAsString=InitializeApplication.DataConn()
' Dimension variables for recordset paging
DimpageSizeAsInteger=HttpContext.Current.Application("SearchNumRows")*HttpContext.Current.Application("SearchNumCols")
DimtotalRowsAsInteger=RecordSetPaging.GetRowCount(userDatabase,"Item_ID","webpages_Portfolio_Items","Item_Body Like '%"&searchQuery&"%' Or Item_Title Like '%"&searchQuery&"%' And Item_Active = 'Y'")
' Configure show all option using < 0 row value
IfpageSize<1ThenpageSize=totalRows
DimpageNumAsString=Request.QueryString("Page")
IfpageNum<=0OrpageNum=""ThenpageNum=1
pageNum=Convert.ToInt32(pageNum)
DimoffsetAsInteger=(pageNum-1)*pageSize
' Get bootstrap column span from page column setting
DimcolumnSpanAsInteger=RecordSetPaging.GetColSpan(HttpContext.Current.Application("SearchNumCols"))
' retrieve the dataset rows for this page
DimdatasourceAsDatabase=Database.Open(userDatabase)
DimsqlQueryAsString="Select Item_ID, Item_Title, Item_Slug, Item_Tagline, Item_FeaturedImage, Item_FeaturedImageCaption, Item_Body, Item_Created FROM webpages_Portfolio_Items WHERE Item_Body Like '%"&searchQuery&"%' Or Item_Title Like '%"&searchQuery&"%' And Item_Active = 'Y' Order by Item_Featured Asc OFFSET @0 ROWS FETCH NEXT @1 ROWS ONLY"
Dimrs_search=datasource.Query(sqlQuery,offset,pageSize)
DimnumItemsAsInteger=rs_search.Count()
EndCode
@SectionMeta
<metaname="Keywords"content="@HttpContext.Current.Application("DefaultKeywords")"/>
<metaname="Description"content="@HttpContext.Current.Application("DefaultDescription")"/>
EndSection
<divclass="app-content">
<divClass="row">
<divClass="row-homefeatured">
<divClass="center-wrapper">
<divClass="col-md-12">
<hgroupclass="title">
<h1>@PageData("Title")</h1>
</hgroup>
<divClass="content-count">
@RecordSetPaging.RecordSetStats(offset,pageNum,pageSize,totalRows)
</div>
</div>
</div>
</div>
</div>
<divid="formcontainer">
<divclass="forms">
<formaction="~/Search"method="get">
<inputid="Query"name="Query"type="text"/>
<inputtype="submit"value="Search"class="button"/>
</form>
</div>
</div>
@Ifrs_search.Any()Then
DimiAsInteger=1
@<divClass="row">
<divClass="row-homefeatured">
<divClass="center-wrapper">
@ForEachitemInrs_search
@<text>
<divclass="col-md-@columnSpan equal_height">
<divclass="@IIf((i Mod 2), "alt_home-featuredequal_height", "home-featuredequal_height")">
<h2>@i.ToString. @item("Item_Title")</h2>
@Ifitem("Item_Tagline")<>""Then
@<h3>@item("Item_Tagline")</h3>
EndIf
<divclass="item-date">@Strings.Format(item("Item_Created"),HttpContext.Current.Application("DateFormat"))</div>
@Ifitem("Item_FeaturedImage")<>""Then
@<divClass="thmb-featured">
<imgsrc="Portfolio_Images/@item("Item_FeaturedImage")"alt="@item("Item_Title")"title="@item("Item_Title")"/>
<divclass="item-featured-caption">@item("Item_FeaturedImageCaption")</div>
</div>
EndIf
@Html.Raw(StringExtensions.HighLightText(item("Item_Body"),HttpContext.Current.Application("FeaturedTextTrim"),-1,-1,". . .",URL.Rewrite("PortfolioDetails?ItemID="&ApplicationSecurity.Encode(item("Item_ID"))&"&Title="&item("Item_Slug")&"&Query="&Server.UrlEncode(searchQuery)&""),"Continue Reading »",searchQuery,"searchtexthighlight"))
</div>
</div>
</text>
i+=1
Next
</div>
</div>
</div>
@IfpageSize<totalRowsThen
@<divClass="row">
<divClass="row-homefeatured">
<divClass="center-wrapper">
<divClass="col-md-12">
@Html.Raw(RecordSetPaging.RecordsetNavBar(offset,pageSize,totalRows,"Search?Query="&Server.UrlEncode(searchQuery)&"","Page",HttpContext.Current.Application("RSNavStyle"),"rs-nav-wrapper"))
</div>
</div>
</div>
</div>
EndIf
Else
@<divClass="row">
<divClass="row-homefeatured">
<divClass="center-wrapper">
<divClass="col-md-12">
@IfNotString.IsNullOrEmpty(searchedFor)Then
@<h2>Nomatchesfoundfor @searchedFor.</h2>
EndIf
</div>
</div>
</div>
</div>
EndIf
</div>