public function get_index() { $reqObj = Input::get(); $val = Validation::forge(); $val->add('id', 'section code')->add_rule('valid_string', array('numeric'))->add_rule('required'); if (!$val->run(Input::get())) { // Forge 404 with query error } $name = $reqObj['id']; $sectionID = $val->validated('id'); $manageObj = new StoryManager(); $listStory = $manageObj->buildSectionPageData($sectionID, 1); $randomStory = array_rand($listStory, 1); if ($randomStory !== null) { $retData['Data']['Highlight'] = $listStory[$randomStory]; } $sectionInfo = $manageObj->getSectionInfoBaseID($this->section_code); $this->side_data['Data'] = array(); $retData['Data']['MainSection'] = $sectionInfo['MainSection']; $retData['Data']['SubSection'][0] = $sectionInfo['MainSection']; $retData['Data']['SubSection'][1] = $sectionInfo['SubSection']; $retData['Data']['News'] = $listStory; $this->template->__yield__ = View::forge('section/overview', $retData); }