Welcome Guest, Not a member yet? Register   Sign In
How does it know which page to load?
#1

Ok, still reading the tutorial and trying to understand how the framework works

Code:
public function view($page = 'home')
{

    if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
    {
        // Whoops, we don't have a page for that!
        show_404();
    }

    $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);

}

So when you go to index.php/pages/view then $title is home, which is clear, but when you go to index.php/pages/view/about then $title is About.

How is it accomplished? Because here is explicitly says - function view($page = 'home')
Reply


Messages In This Thread
How does it know which page to load? - by lexxtoronto - 03-05-2015, 12:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB