$content_template, ); // Set Section Variables if($page_section == 'form') { $section[$page_section]['var'] = array( 'page_activate' => APP_ACTIVATE, 'owner' => $companyName, ); } ////////////////////// $var['country_list'] = $country_list; $var['province_list'] = $province_list; $current_page = isset($_GET['page']) ? intval($_GET['page']) : 1; // $total_record_per_page = 9; $record_per_page = 9; $first_record_index = 1 + ($current_page - 1) * $record_per_page; $total_records = getAllRecordCount(); $total_pages = ceil($total_records/$record_per_page); if($_GET['section'] == 'vote'){ header("Location: https://campaign.esdlife.com/2/HKJMA/2019/10/01/"); die(); $var['story'] = getAllRecords($record_per_page, $first_record_index); $var['page'] = $current_page; $var['total_pages'] = $total_pages; $var['page_prev'] = ($current_page-1 > 0) ? $current_page-1 : 1; $var['next_prev'] = ($current_page+1 < $total_pages) ? $current_page+1 : $total_pages; // $var['img_index_1'] = rand(1,sizeof($var['story'])); // $var['img_index_2'] = rand(1,sizeof($var['story'])); } else { $var['story'] = ""; $var['page'] = ""; $var['total_pages'] = ""; $var['page_prev'] = ""; $var['next_prev'] = ""; // print_r($_GET); exit; } if($_GET['section'] == 'voteDetail'){ header("Location: https://campaign.esdlife.com/2/HKJMA/2019/10/01/"); die(); // print_r($_GET); exit; $var['record_id'] = isset($_GET['recordID']) ? intval($_GET['recordID']) : 1; $var['story_detail'] = getRecordByID(intval($_GET['recordID'])); $content_template = TEMPLATE_PATH."content_".$_GET['section'].".tpl.php"; $page_template = TEMPLATE_PATH."page_".$_GET['section'].".tpl.php"; } else { $var['story_detail'] = ""; } //////////////////////// // Set Page Variables $var['og'] = $page_config['FB_OG'][$page_section]; $var['info'] = array( 'company' => $companyName, 'campaign' => $campaignName, 'url' => CAMPAIGN_PATH, ); $var['html'] = array( 'footer' => $footer_template, 'modal' => $modal_template, 'noscript' => $noscript_template, 'script' => $script_template, 'sections' => $content_template, 'terms' => $terms_template, ); $var['app'] = array( 'activate' => APP_ACTIVATE, 'debug' => $debug, 'theme_color' => $theme_color, ); // Define Page Object $page = new Template($page_template); $page->var = $var; // Display Page ob_start(); $page->display(); ob_end_flush(); ?>