--- new.php 2001/02/28 14:16:33 1.9 +++ new.php 2001/04/05 11:54:08 1.13 @@ -20,7 +20,9 @@ $lpic="investor"; $lext=".jpg"; $mpic="investors.gif"; $back_url="investor.php"; - $sql_where .= " and type='i'"; + if (! isset($type)) { + $sql_where .= " and type='i'"; + } $title.=" : Investors News"; } elseif ($section == "about") { $title="ABOUT US"; @@ -74,6 +76,16 @@ } + if (isset($days)) { + if ($days != 0) { + $sql_where.=" and date(now())-date(date) > 0 and date(now())-date(date) < $days"; + $title.=" : News in last $days days"; + } + $smarty->assign("days",$days); + $smarty->assign("last_days",array(14,30,160,240,365)); + $smarty->assign("last_desc",array("two week","one month","four months","six months","one year")); + } + $num_selected=0; $sql="select id,upper(title) as title,town_date,body,more,pdf, @@ -109,10 +121,26 @@ $title.=" : Community : ".$data[0][title_lc]; } elseif ($data[0][type] == "r") { $title.=" : Result : ".$data[0][title_lc]; + } elseif ($data[0][type] == "i") { + $title.=" : Investors News : ".$data[0][title_lc]; + } elseif ($data[0][type] == "a") { + $title.=" : Annual Report : ".$data[0][title_lc]; } } - $smarty->assign("data",$data); + + if (isset($days) && $num_selected == 0) { + $warning = "There are no news for last $days days."; + } + + if ($main == "" && $num_selected == 0) { + $warning = "This news item is no longer available"; + } + + $smarty->assign(array( + data=>$data, + warning=>$warning + )); $main=$smarty->fetch("new.tpl"); @@ -120,9 +148,6 @@ $main=join('',file(find_html_file("news",$data[0][more]))); } - if ($main == "") { - $main = "This news item is no longer available"; - } }