/[pliva-si]/sections/najdi.inc
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 /sections/najdi.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Mar 27 16:25:28 2002 UTC (17 years, 6 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +63 -4 lines
mnogosearch -> swish

1 <?
2
3 require("class.swish.php");
4 require("class.keywords.php");
5
6 $q=StripSlashes($q);
7
8 $title="Rezultati iskanja '$q'";
9
10 $get_array = array( "DESC" => "swishdescription");
11
12 $main="";
13
14 $n_arr = array( 10, 20, 50 ); // number of results (options)
15
16 if (! isset($n)) $n = $n_arr[0]; // default nr. of resuts
17 if (! isset($f) || $f < 1) $f = 1; // first one
18
19 $l = ($f + $n - 1); // calc last hit on this page
20
21 ### search
22 $kw = new keywords($q,"");
23 $q_kw = $kw->generate();
24
25 $swish = new swish("/data/swish/index/plivasi");
26 $swish->set_params($q_kw,$get_array,"",($f-1),$n);
27
28 $res = $swish->get_result();
29
30 $pages = array();
31
32 for ($i=0; $i<floor(($swish->number_results+$n-1)/$n); $i++) {
33 $pages[] = array (
34 url => "q=".urlencode($q)."&f=".($i*$n+1)."&n=$n",
35 page => $i + 1,
36 current => ($f == ($i*$n+1) ? 1 : 0 ),
37 );
38 if ($f == ($i*$n+1)) $curr_page = $i;
39
40 }
41 if (isset($pages[$curr_page-1])) $prev_page = $pages[$curr_page-1];
42 if (isset($pages[$curr_page+1])) $next_page = $pages[$curr_page+1];
43
44
45 $smarty->assign( array(
46 php_self => $PHP_SELF,
47 res => $res,
48
49 q => $q,
50 q_kw => $q_kw,
51 n_arr => $n_arr,
52 n => $n,
53
54 f => $f,
55 l => $l,
56 t => $swish->number_results,
57 search_time => $swish->search_time,
58 run_time => $swish->run_time,
59
60 pages => $pages,
61 prev_page => $prev_page,
62 next_page => $next_page,
63
64 ));
65 $main=$smarty->fetch("swish.tpl");
66
67 ?>

  ViewVC Help
Powered by ViewVC 1.1.26