1 |
<?php |
2 |
include_once("inc/newsShow.php"); |
3 |
include("inc/conn.php"); |
4 |
if ($show) { |
5 |
$arts = newsLoad($id, $cat); |
6 |
newsShow(array_shift($arts)); |
7 |
} else { |
8 |
$isHome = ($acat || $acat2) ? false : true; |
9 |
$clanci = array(); |
10 |
$cat = "t"; |
11 |
$naslov = ""; |
12 |
if ($acat == "s") { |
13 |
$cat = "c"; |
14 |
$naslov = "Stanja"; |
15 |
if ($acat2 == "z") { $cat = "z"; $naslov .= " - ®ensko zdravlje"; } |
16 |
if ($acat2 == "m") { $cat = "m"; $naslov .= " - Mu¹ko zdravlje"; } |
17 |
if ($acat2 == "d") { $cat = "d"; $naslov .= " - Majka i dijete"; } |
18 |
if ($acat2 == "t") { $cat = "r"; $naslov .= " - Treæa dob"; } |
19 |
if ($acat2 == "l") { $cat = "l"; $naslov .= " - Mladi"; } |
20 |
if ($acat2 == "o") { $cat = "o"; $naslov .= " - Ovisnosti"; } |
21 |
} |
22 |
if ($acat == "l") { |
23 |
$cat = "l"; |
24 |
$naslov = "Lifestyle"; |
25 |
if ($acat2 == "x") { $cat = "x"; $naslov .= " - Sex"; } |
26 |
if ($acat2 == "z") { $cat = "h"; $naslov .= " - Zdrava prehrana"; } |
27 |
if ($acat2 == "f") { $cat = "f"; $naslov .= " - Fitness"; } |
28 |
} |
29 |
if ($acat == "z") { $cat = "i"; $naslov = "Zanimljivosti"; } |
30 |
$arts = newsLoad(-1, $cat, 0, 0, 0); |
31 |
for ($i = 0; $i < count($arts); $i++) { |
32 |
array_push($clanci, array( |
33 |
"naslov" => $arts[$i]["title"], |
34 |
"date" => $arts[$i]["date"] ? strftime("%d.%m.%Y.", strtotime($arts[$i]["date"])) : "", |
35 |
"read" => GetRead($arts[$i]["id"], $cat), |
36 |
"autor" => $arts[$i]["au_name"] |
37 |
)); |
38 |
} |
39 |
$tpl->assign("clanci", $clanci); |
40 |
if ($isHome) { |
41 |
$vijesti = array(); |
42 |
$arts = newsLoad(-1, "w", 0, 0, 0); |
43 |
for ($i = 0; $i < count($arts); $i++) { |
44 |
array_push($vijesti, array( |
45 |
"naslov" => $arts[$i]["title"], |
46 |
"date" => $arts[$i]["date"] ? strftime("%d.%m.%Y.", strtotime($arts[$i]["date"])) : "", |
47 |
"read" => GetRead($arts[$i]["id"], "w"), |
48 |
"autor" => $arts[$i]["au_name"] |
49 |
)); |
50 |
} |
51 |
$tpl->assign("vijesti", $vijesti); |
52 |
$novosti = array(); |
53 |
$arts = newsLoad(-1, "p", 0, 0, 0); |
54 |
for ($i = 0; $i < count($arts); $i++) { |
55 |
array_push($novosti, array( |
56 |
"naslov" => $arts[$i]["title"], |
57 |
"date" => $arts[$i]["date"] ? strftime("%d.%m.%Y.", strtotime($arts[$i]["date"])) : "", |
58 |
"read" => GetRead($arts[$i]["id"], "p"), |
59 |
"autor" => $arts[$i]["au_name"] |
60 |
)); |
61 |
} |
62 |
$tpl->assign("novosti", $novosti); |
63 |
} |
64 |
$tpl->assign("home", $isHome); |
65 |
if ($spec) { |
66 |
$sql = "SELECT opis FROM specijalizacije WHERE spec_id = $spec"; |
67 |
$sth = $dbh->prepare($sql); |
68 |
if (!$sth) error("Cannot prepare query: \"$sql\""); |
69 |
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
70 |
$row = $sth->fetchrow_array(); |
71 |
$sth->finish(); |
72 |
if ($row) $row = array_shift($row); |
73 |
if ($row) { |
74 |
if ($naslov) $naslov .= " - "; |
75 |
$naslov .= $row; |
76 |
} |
77 |
} |
78 |
if (!$naslov) $naslov = $isMed ? "SVE" : "HOME"; |
79 |
if ($naslov) array_push($PATH, $naslov); |
80 |
$tpl->assign("naslov", $naslov); |
81 |
} |
82 |
$dbh->disconnect(); |
83 |
?> |