Welcome Guest, Not a member yet? Register   Sign In
How to get "header" variable
#1

[eluser]Andychan[/eluser]
Hi, I'm come from Hong Kong. Is a Codeigniter novice.

As usual, I make a site with php

will have three part - header.php , main.php , footer.php

And then use rquire_once / include_once combined them

header.php for the detect login or not, and title variable etc.

I'm not sure the CI concept, if I make a simple site, only three page

I will.........

Quote:index.php, index_view.php

about.php, about_view.php

contact.php, contact_view.php

header.php (At View)

footer.php (At View)

every page include header.php and footer.php

if About.php , I want to get some $data , I need to write

Code:
$data['title'] = xxx;

Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class About extends CI_Controller {

    public function index(){        
        
        // layout part
        $this->load->view('header');
        $this->load->view('about_view');
        $this->load->view('footer');
    }
}

/* End of file about.php */


for the repeat use, I will put it into header.php,

Code:
$a = "hello";

but about_view.php cannot get the $a

How can I do?

please help, thanks !!!


Messages In This Thread
How to get "header" variable - by El Forum - 06-16-2011, 07:32 AM
How to get "header" variable - by El Forum - 06-16-2011, 07:50 AM
How to get "header" variable - by El Forum - 06-16-2011, 07:57 AM
How to get "header" variable - by El Forum - 06-16-2011, 08:11 AM
How to get "header" variable - by El Forum - 06-16-2011, 08:14 AM
How to get "header" variable - by El Forum - 06-16-2011, 08:47 AM
How to get "header" variable - by El Forum - 06-16-2011, 08:51 AM
How to get "header" variable - by El Forum - 06-16-2011, 09:01 AM
How to get "header" variable - by El Forum - 06-16-2011, 09:34 AM
How to get "header" variable - by El Forum - 06-16-2011, 09:38 AM
How to get "header" variable - by El Forum - 06-16-2011, 09:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB