root/swish-e/trunk/example/swish.tt

Revision 1904, 5.7 kB (checked in by moseley, 2 years ago)

Adjust the location of the swish-e.gif image

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2
3 [% # This is just an example -- you would want your own "page" for the wrapper %]
4
5 [% WRAPPER page %]
6
7     [% PROCESS swish_header %]
8
9
10     [% title = PROCESS title %]
11
12     [% IF ! search.results %]
13         [% PROCESS show_message %]
14         [% PROCESS search_form %]
15
16     [% ELSE %]
17         [% PROCESS search_form %]
18         [% PROCESS nav_bar %]
19         [% PROCESS results_list %]
20     [% END %]
21
22     [% PROCESS swish_footer %]
23
24 [% END %]
25
26
27 [% # This is just an example -- you would want your own "page" to wrap around "swish" %]
28 [% BLOCK page %]
29 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
30 <html>
31 <head>
32 <title>
33    [% title || "Welcome"  %]
34 </title>
35 <body>
36    [% content %]
37 </body>   
38 </html>   
39 [% END %]
40
41
42 [% BLOCK title %]
43     [% IF ! search.results %]
44         [% search.errstr || search.config('title') || "Search page" %]
45
46     [% ELSE %]
47         [% search.navigation('hits') %] Results for [[% search.query_simple | html %]]
48     [% END %]
49 [% END %]
50
51 [% BLOCK swish_header %]   
52
53     <table border="0" cellpadding="0" cellspacing="0">
54     <tr><td>
55         <a href="http://swish-e.org">
56         <img border="0" alt="Swish-e home page" src="http://swish-e.org/graphics/swish-e.gif"></a>
57     </td><td valign="middle">
58         <font size="+3">[% search.config('title') || "Search page"  %]</font>
59     </td></tr>
60     </table>
61
62 [% END %]   
63
64 [% BLOCK swish_footer %]
65
66     [% PROCESS nav_bar_pages2 %]
67     <hr>
68     <small>Powered by <em>Swish-e</em> <a href="http://swish-e.org">swish-e.org</a></small>
69     [% IF search.MOD_PERL %]
70         <br><small>Response brought to you by <a href="http://perl.apache.org"><em>mod_perl</em></a></small>
71     [% END %]
72   <p>
73     <a href="http://validator.w3.org/check/referer"><img border="0"
74         src="http://www.w3.org/Icons/valid-html401"
75         alt="Valid HTML 4.01!" height="31" width="88"></a>
76   </p>
77 [% END %]   
78
79
80
81 [% BLOCK show_message %]
82     [% IF search.errstr %]
83         <font size="+2" color="red">[% search.errstr | html %]</font>
84     [% END %]
85 [% END %]
86
87
88
89 [% BLOCK search_form %]
90     [% CGI.start_form( '-action' => CGI.script_name, '-method' => 'GET' ) %]
91         [% CGI.textfield( {
92             name    => 'query',
93             size    => 40,
94             maxlength => 200,
95             } ) %]
96
97         [% CGI.submit('submit','Search!') %]<br>
98         [% search.get_meta_name_limits %]
99         [% search.get_sort_select_list %]
100         [% search.get_index_select_list %]
101         [% search.get_limit_select %]
102         [% search.get_date_ranges %]
103        
104     [% CGI.end_form.join('') %]
105
106 [% END %]
107
108
109 [% BLOCK nav_bar %]
110     [% search.stopwords_removed %]
111     <table cellpadding=0 cellspacing=0 border=0 width="100%">
112         <tr>
113             <td height=20 bgcolor="#FF9999">
114                 <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">
115                 &nbsp;Results for <b>[% search.query_simple | html %]</b>
116                 &nbsp; [% search.navigation('from') %] to [% search.navigation('to') %] of [% search.navigation('hits') %] results.
117                 </font>
118             </td>
119             <td align=right bgcolor="#FF9999">
120                 <font size="-2" face="Geneva, Arial, Helvetica, San-Serif">
121                 Run time: [% search.navigation('run_time') %] |
122                 Search time: [% search.navigation('search_time') %] &nbsp; &nbsp;
123                 </font>
124             </td>
125         </tr>
126
127         [% IF search.navigation('pages') %]
128
129         <tr>
130             <td colspan=2 bgcolor="#EEEEEE">
131                 [%# PROCESS nav_bar_pages %]
132                 [% PROCESS nav_bar_pages2 %]
133             </td>
134         </tr>
135         [% END %]
136
137     </table>
138 [% END %]
139
140 [% BLOCK nav_bar_pages %]               
141     <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">&nbsp;Page:</font>
142     [% search.navigation('pages') %]
143
144     [% IF search.navigation('prev_count') %]
145         <a href="[% search.query_href %]&amp;start=[% search.navigation('prev') %]">
146         Previous [% search.navigation('prev_count') %]</a>
147     [% END %]
148
149     [% IF search.navigation('next_count') %]
150         <a href="[% search.query_href %]&amp;start=[% search.navigation('next') %]">
151         Next [% search.navigation('next_count') %]</a>
152     [% END %]
153 [% END %]
154
155 [%#
156     Insead of pre-formatted numeric page links as above, you can use this
157     example to generate the pages individually.
158     For example, allows using images for page numbers.
159 %]
160
161 [% BLOCK nav_bar_pages2 %]
162     &nbsp;
163
164     [% IF search.navigation('prev_count') %]
165         <a style="text-decoration:none" href="[% search.query_href %]&amp;start=[% search.navigation('prev') %]">&lt;&lt;</a>
166     [% END %]
167
168
169     [% FOR page = search.navigation('page_array') %]
170         [% IF page.cur_page %]
171             [[% page.page_number %]]
172         [% ELSE %]
173             <a style="text-decoration:none" href="[% search.query_href %];start=[% page.page_start %]">[% page.page_number %]</a>
174         [% END %]
175     [% END %]
176
177     [% IF search.navigation('next_count') %]
178         <a style="text-decoration:none" href="[% search.query_href %]&amp;start=[% search.navigation('next') %]">&gt;&gt;</a>
179     [% END %]
180 [% END %]
181
182
183
184
185 [% BLOCK results_list %]
186     [% FOREACH item = search.results %]
187         <dl>
188             <dt>
189                 [% item.swishreccount %]
190                  <a href="[% item.swishdocpath_href %]">
191                 [% ( item.swishtitle || item.swishdocpath )  %]
192                 </a>
193
194                 <small>-- rank: <b>[% item.swishrank %]</b></small>
195             </dt>
196
197             <dd>
198                 [% item.swishdescription %]
199                 <br>
200                 <small>
201                     [% item.swishdocpath %]
202                     - [% item.swishdocsize %] bytes
203                     - [% item.swishlastmodified %]
204                 </small>
205             </dd>
206         </dl>
207     [% END %]
208 [% END %]
209    
210
211    
212
Note: See TracBrowser for help on using the browser.