Welcome Guest, Not a member yet? Register   Sign In
Query in CI Tutorial
#1

I am studying CI documents wherein I have a query as below in the Tutorial:

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);
}
 
In last 3 lines $data variable – how come same variable has 3 different values, that of content in header.php, footer.php & content of page.php file? Confusion in syntax/ usage of array $data[‘title’] & just $data.
Reply


Messages In This Thread
Query in CI Tutorial - by Sovani Shreeniwas - 01-07-2019, 02:49 AM
RE: Query in CI Tutorial - by Pertti - 01-07-2019, 03:40 AM
RE: Query in CI Tutorial - by php_rocs - 01-07-2019, 05:57 PM
RE: Query in CI Tutorial - by dave friend - 01-08-2019, 01:29 PM
RE: Query in CI Tutorial - by Sovani Shreeniwas - 01-09-2019, 03:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB