Welcome Guest, Not a member yet? Register   Sign In
View data being carried through to the next view?
#3

[eluser]CMCDragonkai[/eluser]
I have the exact same problem except that I cannot redeclare the variables as nothing like what darkhouse said

Code:
$data = array('heading'=>'', 'class'='');
$this->load->view("core/panel_top.php", $data);
$this->load->view("core/panel_bottom.php");

This is because when I pass $data to the the view, it is in a loop and when a new $data is passed the next view, it does not have the same array keys as the previous $data.

I tried unsetting $data in the model, but it still does not work. I tried unsetting the variables in the view, it also does not work.

There must be some way to clear the variables from one view to another.

The specific function I'm trying to do at the moment is to use an attachment_view as a template. I loop through attachment bbcodes and replace each attachment bbcode with their correct html. I'm using $attachment_html = $this->CI->load->view('attachment_view', $data, true); The correct html is located in the attachment_view. There are different kinds of attachments, which means there are different kinds of html to show it. In the attachment_view it uses alot of if-elses to select to correct html.

The problem is, the if-else runs true for the wrong html because the boolean variables carry on from the previous view to the next.


Messages In This Thread
View data being carried through to the next view? - by El Forum - 07-11-2009, 10:10 AM
View data being carried through to the next view? - by El Forum - 07-12-2009, 06:13 AM
View data being carried through to the next view? - by El Forum - 12-24-2010, 11:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB