root/trunk/Vanilla/templates/vanilla+search+tags/search_results.mtml @ 924

Revision 924, 6.2 kB (checked in by bsmith, 16 months ago)

adding vanilla+search+tags

Line 
1<mt:IncludeBlock module="Wrapper">
2
3<mt:Ignore><!-- Below Javascript adds ajax search capability --></mt:Ignore>
4<mt:SetVarBlock name="html_head" append="1">
5<script type="text/javascript">
6/* <![CDATA[ */
7var user = <$mt:UserSessionState$>;
8<mt:IfMoreResults>
9function getResults(page) {
10    page = parseInt(page);
11    if (timer) window.clearTimeout(timer);
12    var xh = mtGetXmlHttp();
13    if (!xh) return false;
14    var res = results[page];
15    if (!res) return;
16    var url = res['next_url'];
17    if (!url) return;
18
19    xh.open('GET', url + '&format=js', true);
20    xh.onreadystatechange = function() {
21        if ( xh.readyState == 4 ) {
22            if ( xh.status && ( xh.status != 200 ) ) {
23                // error - ignore
24            } else {
25                try {
26                    var page_results = eval("(" + xh.responseText + ")");
27                    if ( page_results['error'] == null )
28                        results[page + 1] = page_results['result'];
29                } catch (e) {
30                }
31            }
32        }
33    };
34    xh.send(null);
35}
36
37function swapContent(direction) {
38    if ( direction == undefined ) direction = 1;
39    var page_span = document.getElementById('current-page');
40    if (!page_span) return true;
41    var next_page = direction + parseInt(page_span.innerHTML);
42    var res = results[next_page];
43    if (!res) return true;
44    var content = res['content'];
45    if (!content) return true;
46    var div = document.getElementById('search-results');
47    if (!div) return true;
48    div.innerHTML = content;
49    timer = window.setTimeout("getResults(" + next_page + ")", 1*1000);
50    window.scroll(0, 0);
51    return false;
52}
53<mt:Else>
54    <mt:IfPreviousResults>
55function swapContent(direction) {
56        return true;
57}
58    </mt:IfPreviousResults>
59</mt:IfMoreResults>
60/* ]]> */
61</script>
62</mt:SetVarBlock>
63
64<mt:SetVarTemplate id="search_results" name="search_results"> 
65    <mt:SearchResults>
66        <mt:SearchResultsHeader>
67<div id="search-results">
68    <h1 id="page-title" class="search-results-header">
69        <mt:IfStraightSearch>
70        <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$mt:SearchString$>">
71        </mt:IfStraightSearch>
72        <mt:IfTagSearch>
73        <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$mt:SearchString$>">
74        </mt:IfTagSearch>
75    </h1>
76    <div class="content-nav">
77        <span class="results-previous-link"><mt:IfPreviousResults><a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">&laquo; <__trans phrase="Previous"></a><mt:else>&laquo; <__trans phrase="Previous"></mt:IfPreviousResults></span>&nbsp;&nbsp;<mt:PagerBlock><mt:IfCurrentPage><strong class="results-current-page"><$mt:Var name="__value__"$></strong><mt:Else><a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a></mt:IfCurrentPage><mt:Unless name="__last__">&nbsp;</mt:Unless></mt:PagerBlock>&nbsp;&nbsp;<span class="results-previous-link"><mt:IfMoreResults><a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();"><__trans phrase="Next"> &raquo;</a><mt:else><__trans phrase="Next"> &raquo;</mt:IfMoreResults></span>
78    </div>
79    <div class="search-results-container autopagerize_page_element">
80        </mt:SearchResultsHeader>
81        <h2><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a></h2>
82        <p><__trans phrase="By [_1] on [_2]" params="<$mt:EntryAuthorLink$>%%<$mt:EntryDate format="%x %X"$>"></p>
83        <mt:If tag="EntryBody">
84            <$mt:EntryBody$>
85        </mt:If>
86        <mt:If tag="EntryMore" convert_breaks="0">
87            <em><__trans phrase="Continue reading <a href="[_1]">[_2]</a>." params="<$mt:EntryPermalink$>%%<$mt:EntryTitle$>"></em>
88        </mt:If>
89        <mt:SearchResultsFooter>
90    </div>
91    <mt:Ignore>autopagerize_insert_before - Used with the ajax search capability of the new search class</mt:Ignore>
92    <div class="autopagerize_insert_before"></div>
93    <div class="content-nav">
94        <span class="results-previous-link"><mt:IfPreviousResults><a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">&laquo; <__trans phrase="Previous"></a><mt:else>&laquo; <__trans phrase="Previous"></mt:IfPreviousResults></span>&nbsp;&nbsp;<mt:PagerBlock><mt:IfCurrentPage><strong class="results-current-page"><$mt:Var name="__value__"$></strong><mt:Else><a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a></mt:IfCurrentPage><mt:Unless name="__last__">&nbsp;</mt:Unless></mt:PagerBlock>&nbsp;&nbsp;<span class="results-previous-link"><mt:IfMoreResults><a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();"><__trans phrase="Next"> &raquo;</a><mt:else><__trans phrase="Next"> &raquo;</mt:IfMoreResults></span>
95    </div>
96</div>
97        </mt:SearchResultsFooter>
98    </mt:SearchResults>
99</mt:SetVarTemplate>
100<$mt:Var name="search_results"$>
101
102<mt:NoSearchResults>
103<h1 id="page-title" class="search-results-header">
104    <mt:IfStraightSearch>
105    <__trans phrase="Results matching &ldquo;[_1]&rdquo;" params="<$mt:SearchString$>">
106    </mt:IfStraightSearch>
107    <mt:IfTagSearch>
108    <__trans phrase="Results tagged &ldquo;[_1]&rdquo;" params="<$mt:SearchString$>">
109    </mt:IfTagSearch>
110</h1>
111<p><__trans phrase="No results found for &ldquo;[_1]&rdquo;." params="<$mt:SearchString$>"></p>
112</mt:NoSearchResults>
113
114<mt:NoSearch>
115<h1 id="page-title" class="search-results-header"><__trans phrase="Instructions"></h1>
116<p><__trans phrase="By default, this search engine looks for all words in any order. To search for an exact phrase, enclose the phrase in quotes:"></p>
117<blockquote>
118    <p><code>"<__trans phrase="movable type">"</code></p>
119</blockquote>
120<p><__trans phrase="The search engine also supports AND, OR, and NOT keywords to specify boolean expressions:"></p>
121<blockquote>
122    <p><code><__trans phrase="personal OR publishing"></code></p>
123    <p><code><__trans phrase="publishing NOT personal"></code></p>
124</blockquote>
125</mt:NoSearch>
126
127<mt:Ignore>Used with the ajax search capability of the new search class</mt:Ignore>
128<mt:IfMoreResults>
129<script type="text/javascript">
130<!--
131var div = document.getElementById('search-results');
132var results = {
133    '<$mt:CurrentPage$>': {
134        'content': div.innerHTML,
135        'next_url': '<$mt:NextLink$>'
136    }
137};
138var timer = window.setTimeout("getResults(" + <$mt:CurrentPage$> + ")", 1*1000);
139//-->
140</script>
141</mt:IfMoreResults>
142
143</mt:IncludeBlock>
Note: See TracBrowser for help on using the browser.