template_dir = "./templates"; $smarty->compile_dir = "./templates_c"; require_once("dbini.php"); $con =mysql_connect($DBSERVER,$DBUSER,$DBPASSWORD); $selectdb =mysql_select_db($DBNAME,$con); mysql_query("SET NAMES utf8"); $news=array(); $sql="select * from amica_news order by checkdate desc"; $rst=mysql_query($sql,$con); while($col=mysql_fetch_array($rst)){ $no=$col["no"]; $year=$col["year"]; $month=$col["month"]; $day=$col["day"]; $date="$year/$month/$day"; $title=$col["title"]; $comment=$col["comment"]; $news[]=array("no"=>$no,"date"=>$date,"title"=>$title,"comment"=>$comment); } $smarty->assign("news", $news); $smarty->display("index.tpl"); ?>