/[corp_html]/swish.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /swish.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Mar 27 16:00:18 2002 UTC (22 years ago) by dpavlin
Branch: MAIN
*** empty log message ***

1 <?php
2
3 require("Smarty.class.php");
4 require("conn.inc");
5
6 require("class.swish.php");
7 require("class.keywords.php");
8
9 $smarty = new Smarty;
10
11 $smarty->assign( array ( Title=>"Pliva d.d." ) );
12
13 $section="search";
14
15 $q=StripSlashes($q);
16
17 $title="Search results for '$q'";
18 $lpic="search"; $lext=".jpg";
19 $mpic="search.gif";
20
21
22 $get_array = array( "DESC" => "swishdescription");
23
24
25
26 $main="";
27
28 $n_arr = array( 10, 20, 50 ); // number of results (options)
29
30 if (! isset($n)) $n = $n_arr[0]; // default nr. of resuts
31 if (! isset($f) || $f < 1) $f = 1; // first one
32
33 $l = ($f + $n - 1); // calc last hit on this page
34
35 ### search
36 $kw = new keywords($q,"");
37 $q_kw = $kw->generate();
38
39 $swish = new swish("/data/swish/index/corp");
40 $swish->set_params($q_kw,$get_array,"",($f-1),$n);
41
42 $res = $swish->get_result();
43
44 $pages = array();
45
46 for ($i=0; $i<floor(($swish->number_results+$n-1)/$n); $i++) {
47 $pages[] = array (
48 url => "q=".urlencode($q)."&f=".($i*$n+1)."&n=$n",
49 page => $i + 1,
50 current => ($f == ($i*$n+1) ? 1 : 0 ),
51 );
52 if ($f == ($i*$n+1)) $curr_page = $i;
53
54 }
55 if (isset($pages[$curr_page-1])) $prev_page = $pages[$curr_page-1];
56 if (isset($pages[$curr_page+1])) $next_page = $pages[$curr_page+1];
57
58
59 $smarty->assign( array(
60 php_self => $PHP_SELF,
61 res => $res,
62
63 q => $q,
64 q_kw => $q_kw,
65 n_arr => $n_arr,
66 n => $n,
67
68 f => $f,
69 l => $l,
70 t => $swish->number_results,
71 search_time => $swish->search_time,
72 run_time => $swish->run_time,
73
74 pages => $pages,
75 prev_page => $prev_page,
76 next_page => $next_page,
77
78 ));
79 $main=$smarty->fetch("swish.tpl");
80
81 $smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) );
82
83 if ($HTTP_REFERER) {
84 $back_url=$HTTP_REFERER;
85 } else {
86 $back_url="index.php";
87 }
88
89 include("common.inc");
90 $smarty->assign( array(
91 back_url=>"swish.php",
92 MAIN=>$main
93 ) );
94
95 $smarty->display("index.tpl");
96 ?>
97

  ViewVC Help
Powered by ViewVC 1.1.26