php - Codeigniter :Parsing array data in view -


i trying fetch posts data , past view using controller

 $data['data']=$this->home->fetch_all_posts($this->news);  $this->load->view('home',$data); 

in view when print_r($data)

array (       [0] => array         (             [post] => stdclass object                 (                     [id] => 65                     [date] => 2016-07-08                     [title] =>  title of news                      [content] => content of news                      [type] => news                 )              [attachments] => stdclass object                 (                     [id] => 2                     [attachment_id] => 65                     [type] => news                     [path] => c:/wamp/www/school/ci/images/jellyfish22.jpg                 )          )  ) 

now when try foreach , print not work , please helo how can print these values

codeiginiter turn values of $data it's own variables. $data['foobar'] becomes $foobar in view. use of $data['data'] can confusing , vague, i'd suggest using more specific name.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -