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 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 |
#include("debug.inc"); |
25 |
|
26 |
if ($multi_page) { |
27 |
$max=count($multi_page); |
28 |
$next=$multi_page[$current+1]; |
29 |
$show=0; |
30 |
|
31 |
$uri=basename($GLOBALS[REQUEST_URI]); |
32 |
|
33 |
for ($i=0; $i<=$max; $i++) { |
34 |
if ($multi_page[$i]==substr($uri,0,strlen($uri))) { |
35 |
$current=$i; |
36 |
$show=1; |
37 |
} |
38 |
} |
39 |
|
40 |
if ($current && $current!=0) { |
41 |
$prev=$multi_page[$current-1]; |
42 |
} |
43 |
if ($current && $current!=$max) { |
44 |
$next=$multi_page[$current+1]; |
45 |
} |
46 |
if ($show) { |
47 |
$smarty->assign(array( |
48 |
"multi_page"=>$multi_page, |
49 |
"multi_page_current"=>($current+1), |
50 |
"multi_page_max"=>$max, |
51 |
"multi_page_prev"=>$prev, |
52 |
"multi_page_next"=>$next |
53 |
)); |
54 |
} |
55 |
|
56 |
} |
57 |
|
58 |
?> |