Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]..Problem with views
#1

[eluser]ranjeet_sangle[/eluser]
Hello everyone,
I am having a strange problem, I have used following code for displaying the homepage

function index()
{
$data['title'] = "Some Title";
$this->load->view("title",$data);//to display header of webpage
$this->load->view("left_pane");//to display menu at the left side
$this->load->view("main");//to display the body
$this->load->view("footer");`
}

this is working fine and it exactly displays as intended.

but when i use the same procedure in some other function of same or other controller,

e.g;
function gpr()
{
$data['title'] = "Some Title";
$this->load->view("title",$data );
$this->load->view("left_pane");
$this->load->view("some_other_view"); //I tried main also
$this->load->view("footer")
}

then the output is not the same.

Now in the output only the views "left_pane" and "some_other_view" is displayed

But the views "title" and "footer" are not displayed.


"Can you please tell me where is the problem"


Please guys help me I am worried Sad
#2

[eluser]InsiteFX[/eluser]
From the userguide:

$this->load->vars($array)

This function takes an associative array as input and generates variables using the PHP extract function. This function produces the same result as using the second parameter of the $this->load->view() function above. The reason you might want to use this function independently is if you would like to set some global variables in the constructor of your controller and have them become available in any view file loaded from any function. You can have multiple calls to this function. The data get cached and merged into one array for conversion to variables.

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB