--- new.php 2001/02/22 20:51:10 1.4 +++ new.php 2001/03/17 18:19:40 1.11 @@ -13,11 +13,21 @@ $section="new"; } +$sql_where="where visible is true"; + if ($section == "investor") { $title="INVESTOR'S PAGE"; $lpic="investor"; $lext=".jpg"; $mpic="investors.gif"; $back_url="investor.php"; + if (! isset($type)) { + $sql_where .= " and type='i'"; + } + $title.=" : Investors News"; +} elseif ($section == "about") { + $title="ABOUT US"; + $lpic="about"; $lext=".gif"; + $mpic="about.gif"; } else { $title="What's New"; $lpic="new"; $lext=".jpg"; @@ -25,9 +35,8 @@ $back_url="index.php"; } -$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); +$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, ) ); -$sql_where="where visible is true"; function find_html_file($dir,$file) { $file="./$dir/$file"; @@ -47,10 +56,64 @@ $sql_where.=" and id=$id "; } - $sth = $dbh->prepare("select id,upper(title) as title,town_date,body,more,pdf from news $sql_where order by date desc"); + if (isset($type)) { + if ($type == "n") { + $sql_where .= " and (type='n' or type='i')"; + $title.=" : News"; + } elseif ($type == "e") { + $sql_where .= " and type='e'"; + $title.=" : Events"; + } elseif ($type == "c") { + $sql_where .= " and type='c'"; + $title.=" : Community"; + } + } + + if (! isset($show) && !isset($start)) { + $sql_limit="limit 10"; + } elseif (isset($start)) { + $sql_limit="limit 10,$start"; + } + + + $num_selected=0; + $sql="select + id,upper(title) as title,town_date,body,more,pdf, + (date-now()::date) as comming,type,title as title_lc + from news $sql_where order by priority desc,date desc $sql_limit"; +# print "$sql"; + $sth = $dbh->prepare("$sql"); $sth->execute(); while ($row=$sth->fetchrow_hash()) { $data[]=$row; + $num_selected++; + } + + if ($num_selected == 10) { + $smarty->assign(array( + "multi_page_show" => 1, + "multi_page_next" => "$PHP_SELF?start=".($start+10), + )); + } + if ($start && $start >= 10) { + $smarty->assign(array( + "multi_page_show" => 1, + "multi_page_prev" => "$PHP_SELF?start=".($start-10), + )); + } + + if (isset($id) && $num_selected == 1) { + if ($data[0][type] == "n") { + $title.=" : News : ".$data[0][title_lc]; + } elseif ($data[0][type] == "e") { + $title.=" : Event : ".$data[0][title_lc]; + } elseif ($data[0][type] == "c") { + $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]; + } } $smarty->assign("data",$data); @@ -68,7 +131,8 @@ } include("common.inc"); -$smarty->assign( array(back_url=>$back_url, MAIN=>$main)); +$smarty->assign( array(back_url=>$back_url, MAIN=>$main, + Section_title=>$title ) ); $smarty->display("index.tpl"); ?>