[eluser]Cameron Steele[/eluser]
Let's say I'm setting a variable in my controller that I use in my view called "header" to set the title of the page. Assuming that (for some reason) I only wanted to include the header view once, but I wanted to set the page title variable in an <i>if</i> statement after I included the header view, would there be anything wrong with including the data in the content view during the <i>if</i> statement?
In other words:
Code:
$this->load->view('header');
if ($this->form_validation->run() == FALSE)
{
$this->data['pagetitle'] = "Fail";
$this->load->view('failure', $this->data);
}
else
{
$this->data['pagetitle'] = "Not fail";
$this->load->view('success', $this->data);
}
$this->load->view('footer');
If "header" view uses $this->data['pagetitle'], is this still legit code? Could I even include the data in the "footer" load?
I would assume that the PHP happens and the variables get tossed into the collection of views prior to getting to the user's browser, but I just want to be sure there's nothing wrong with this.
Thanks!