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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Sep 10 13:25:01 2001 UTC (22 years, 6 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +7 -1 lines
Pliva magazin, template za publikacije, logo-i za publikacije

1 <?
2
3 include("news_sif.inc");
4
5 $sql_where="where visible is true";
6
7 if (file_exists(find_html_file("more",$more))) {
8
9 $main=join('',file(find_html_file("more",$more)));
10 $back_url=$GLOBALS[HTTP_REFERER];
11
12 } else {
13 if (isset($id)) {
14 $sql_where.=" and id=$id ";
15 }
16
17 if (isset($type)) {
18 if ($type == "n") {
19 $sql_where .= " and substr(type,1,1)='n'";
20 $title.=" : Novosti";
21 } elseif ($type == "e") {
22 $sql_where .= " and substr(type,1,1)='e'";
23 $title.=" : Dogotki";
24 } elseif (strlen($type) == 3) {
25 $sql_where .= " and type='$type'";
26 }
27 }
28
29 if (! isset($show) && !isset($start)) {
30 $sql_limit="limit 10";
31 } elseif (isset($start)) {
32 $sql_limit="limit 10,$start";
33 }
34
35
36 if (isset($days)) {
37 if ($days != 0) {
38 $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days";
39 $title.=" : News in last $days days";
40 }
41 $smarty->assign("days",$days);
42 $smarty->assign("last_days",array(14,30,160,240,365));
43 $smarty->assign("last_desc",array("two weeks","one month","four months","six months","one year"));
44 }
45
46 $num_selected=0;
47 $sql="select
48 id,upper(title) as title,town_date,body,more,pdf,
49 (date-now()::date) as comming,type,title as title_lc
50 from news $sql_where order by priority desc,date desc $sql_limit";
51 # print "$sql";
52 $sth = $dbh->prepare("$sql");
53 $sth->execute();
54 while ($row=$sth->fetchrow_hash()) {
55 $data[]=$row;
56 $num_selected++;
57 }
58
59 if ($num_selected == 10) {
60 $tmp="$PHP_SELF?start=".($start+10);
61 if ($days) $tmp.="&days=$days";
62 $smarty->assign(array(
63 "multi_page_show" => 1,
64 "multi_page_next" => $tmp
65 ));
66 }
67 if ($start && $start >= 10) {
68 $tmp="$PHP_SELF?start=".($start-10);
69 if ($days) $tmp.="&days=$days";
70 $smarty->assign(array(
71 "multi_page_show" => 1,
72 "multi_page_prev" => $tmp
73 ));
74 }
75
76 if (isset($id) && $num_selected == 1) {
77 $title.=" : ".$news_sif[$data[0][type]];
78 $title.=" : ".$data[0][title_lc];
79 }
80
81
82 if (isset($days) && $num_selected == 0) {
83 $warning = "There are no news for last $days days.";
84 } elseif ($main == "" && $num_selected == 0) {
85 $warning = "This news item is no longer available";
86 }
87
88 $smarty->assign(array(
89 data=>$data,
90 warning=>$warning
91 ));
92
93
94 if (isset($id) && find_html_file("more",$data[0][more])) {
95 $main=join('',file(find_html_file("more",$data[0][more])));
96 } else {
97 $logo="p/${p}_".$data[0][type].".jpg";
98 if (file_exists($logo)) {
99 $smarty->assign("logo",$logo);
100 }
101 $main=$smarty->fetch("$p.tpl");
102 }
103
104
105 }
106
107 $smarty->assign( array(back_url=>$back_url) );
108
109
110 ?>

  ViewVC Help
Powered by ViewVC 1.1.26