/** * Browser visits /api * @return void */ public function action_index() { // Here, we render the views/pages/api.php view file, pass it in the data array, and // return the data as a string to stick back into the data array as the layout view's // $content variable. $this->page_data['content'] = \Sleek\View::render('pages/api', $this->page_data, TRUE); }
/** * This is the page the user hits when submitting a URL via their browser. * @return void */ public function action_submit() { $url = $this->request->post('url'); $this->page_data['code'] = FALSE; if ($url && filter_var($url, FILTER_VALIDATE_URL)) { $EzLink = new Model_EzLink(); $id = $EzLink->insertUrl($url); $this->page_data['code'] = Model_EzLink::integerToCode($id); } $this->page_data['content'] = \Sleek\View::render('pages/submit', $this->page_data, TRUE); }
/** * Renders a view and sends it to the browser. Can't be used to return strings. * To return a string, use \Sleek\View::render($file, $data, TRUE) instead. * @param string $file Path to view file to render, minus the extension * @param array $data Data array, ran through extract() * @return void */ public function view($file, $data = array()) { \Sleek\View::render($file, $data); }
/** * This is the page when the user visits /statistics * @return void */ public function action_index() { $this->page_data['content'] = \Sleek\View::render('pages/statistics', $this->page_data, TRUE); }