function index() { $page = isset($_GET['page']) ? tin($_GET['page']) : 1; $limit = 5; $begin = ($page - 1) * $limit; $tm = date("n"); $cm = new CalendarModel(); $jml = $cm->getJumlah("cal_begin > NOW()"); $jmlpage = ceil($jml / $page); if ($page > $jmlpage) { die; } $arrentry = $cm->getWhere("cal_begin > NOW() ORDER BY cal_begin ASC LIMIT {$begin},{$limit}"); $ct = new CalendarTypeModel(); $arrct = $ct->getAll(); foreach ($arrct as $ct) { $arrc[$ct->cal_type_id] = $ct; } // pr($arrentry); $arr['entry'] = $arrentry; $arr['type'] = $arrc; $arr['page'] = $page; $arr['limit'] = $limit; $arr['jml'] = $jml; $arr['jmlpage'] = $jmlpage; $layout_id = "Calendar_index"; $file = Layout::getFile($layout_id); // echo "Pages/".$layout_id."/".$file; Mold::theme("Pages/" . $layout_id . "/" . $file, $arr); // Mold::theme("Pages/Calendar_index",$arr); if ($page > 1) { die; } }