php - Codeigniter view returned as a string with data -


i'm using codeigniter 3 , im trying pull in view variable, , pass data view inclusion. view not recognising data being passed , telling me variable doesn't exist.

this how i'm calling view:

$view = $this->load->view('notifications/' . $report_type, $data ,true); 

and in view i'm trying loop through $data , display appropriate, so:

foreach($data $item){     // echo stuffs } 

i know $data definately contains data i've var_dump'ed it.

can this?

you need pass associative array loader.

$view = $this->load->view('notifications/' . $report_type, array('data' =>$data) ,true); 

now variable visible @ view.


Comments

Popular posts from this blog

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -