Welcome Guest, Not a member yet? Register   Sign In
Newbie question

I'm a complete newbie and going through the CodeIgniter tutorial at this link.


When I get to the section "Adding logic to the controller, I don't understand what to do when it says "In order to load those pages, you’ll have to check whether the requested page actually exists:"  What am I supposed to do with the code below which is pasted below? Am I supposed to put it in the controller that I created just few lines above? 


public function view($page = 'home')
        if ( ! file_exists(APPPATH.'views/pages/'.$page.'.php'))
                // Whoops, we don't have a page for that!

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/footer', $data);

Messages In This Thread
Newbie question - by ronniebel - 07-23-2019, 11:03 AM
RE: Newbie question - by InsiteFX - 07-23-2019, 02:55 PM
RE: Newbie question - by ronniebel - 07-24-2019, 09:36 AM
RE: Newbie question - by InsiteFX - 07-24-2019, 05:14 PM

Theme © iAndrew 2016 - Forum software by © MyBB