Fetching content from file into variable? |
[eluser]solid9[/eluser]
Hi guys I'm trying to fetch the content of a file in view folder and insert it into variable. Because my header, footer etc... is in external view file. Example: Code: function login() Please help me correct the code above. Thanks in advanced.
[eluser]Matt S.[/eluser]
You could just do this instead of loading the header and footer in every view file: Code: function login()
[eluser]solid9[/eluser]
I know that, that is the conventional way. The problem with that it produces un-necessary files in view folder. I don't think you understand me.
[eluser]CroNiX[/eluser]
You need to set the 3rd parameter of load::view() to TRUE so it will return the view instead of output it, as described in the user guide. Code: $this->$data['header'] = $this->load->view('header', null, TRUE);
[eluser]Matt S.[/eluser]
[quote author="solid9" date="1327292002"]I know that, that is the conventional way. The problem with that it produces un-necessary files in view folder. I don't think you understand me.[/quote] I guess I am confused, because it looked like what you were trying to do. Could you explain or show what is in your "front_page" view? Also, when loading data into the second parameter of $this->load->view(), you don't need to put it in a class property. Just use a local variable, like so: Code: $data['header'] = something...;
|
Welcome Guest, Not a member yet? Register Sign In |