prepare(); switch ($action) { case "view": $tpl->newBlock("LISTVIEW"); $sql ="SELECT * FROM program WHERE id = '$id'"; $field = $db->get_row($sql); $num_rows = $db->num_rows; if($num_rows>0){ $tpl->assign( "title", $field->title ); $tpl->assign( "rate", $field->rate ); $tpl->assign( "text", $field->text ); } $title = $field->title; $pageNav = " > โปรแกรมตรวจสุขภาพ > $field->title"; break; default: $sql ="SELECT * FROM program WHERE (startDate<='$today' AND endDate>='$today') AND isDelete = false"; $record = $db->get_results($sql); $num_rows = $db->num_rows; if($num_rows>0){ foreach ( $record as $field ){ $tpl->newBlock("LIST"); $tpl->assign( "title", $field->title ); $tpl->assign( "image", $field->image ); $tpl->assign( "id", $field->id ); } } $title = "โปรแกรมตรวจสุขภาพ"; $pageNav = " > โปรแกรมตรวจสุขภาพ"; } $tpl->gotoBlock("_ROOT"); $tpl->assign( "title", $title ); $tpl->assign( "filename", "1222189354.jpg" ); $tpl->assign( "pageNav", $pageNav ); $tpl->printToScreen(); ?>