1 |
<? |
2 |
|
3 |
global $smarty,$dbh; |
4 |
|
5 |
// fetch menu |
6 |
|
7 |
$sth = $dbh->prepare("select item,url,file from menu where section='$section' order by num"); |
8 |
$sth->execute(); |
9 |
while ($row=$sth->fetchrow_hash()) { |
10 |
$menu[]=$row; |
11 |
} |
12 |
|
13 |
$smarty->assign("menu",$menu); |
14 |
|
15 |
// fetch news |
16 |
|
17 |
$sth = $dbh->prepare("select id,title from news where type='n' and visible order by id desc limit 5"); |
18 |
$sth->execute(); |
19 |
while ($row=$sth->fetchrow_hash()) { |
20 |
$news[]=$row; |
21 |
} |
22 |
$smarty->assign("news",$news); |
23 |
|
24 |
$sth = $dbh->prepare("select id,title from news where type='e' and visible order by id desc limit 5"); |
25 |
$sth->execute(); |
26 |
while ($row=$sth->fetchrow_hash()) { |
27 |
$events[]=$row; |
28 |
} |
29 |
$smarty->assign("events",$events); |
30 |
|
31 |
#include("debug.inc"); |
32 |
|
33 |
if ($multi_page) { |
34 |
$max=count($multi_page); |
35 |
$next=$multi_page[$current+1]; |
36 |
$show=0; |
37 |
|
38 |
$uri=basename($GLOBALS[REQUEST_URI]); |
39 |
|
40 |
for ($i=0; $i<=$max; $i++) { |
41 |
if ($multi_page[$i]==substr($uri,0,strlen($uri))) { |
42 |
$current=$i; |
43 |
$show=1; |
44 |
} |
45 |
} |
46 |
|
47 |
if ($current && $current!=0) { |
48 |
$prev=$multi_page[$current-1]; |
49 |
} |
50 |
if ($current && $current!=$max) { |
51 |
$next=$multi_page[$current+1]; |
52 |
} |
53 |
if ($show) { |
54 |
$smarty->assign(array( |
55 |
"multi_page"=>$multi_page, |
56 |
"multi_page_current"=>($current+1), |
57 |
"multi_page_max"=>$max, |
58 |
"multi_page_prev"=>$prev, |
59 |
"multi_page_next"=>$next |
60 |
)); |
61 |
} |
62 |
|
63 |
} |
64 |
|
65 |
?> |