jeudi 7 septembre 2017

passing array into view (codeigniter )

array(2) {
  [0]=>
  object(stdClass)#21 (7) {
    ["id"]=>
    string(1) "1"
    ["title"]=>
    string(7) "cvxzcvd"
    ["con"]=>
    string(10) "gvsdvgsdfg"
    ["is_important"]=>
    string(1) "1"
    ["date"]=>
    string(3) "123"
    ["image"]=>
    string(2) "55"
    ["cat_id"]=>
    string(1) "1"
  }
  [1]=>
  object(stdClass)#22 (7) {
    ["id"]=>
    string(1) "2"
    ["title"]=>
    string(4) "fsdf"
    ["con"]=>
    string(9) "dfdsfvfds"
    ["is_important"]=>
    string(1) "1"
    ["date"]=>
    string(4) "5145"
    ["image"]=>
    string(7) "5454124"
    ["cat_id"]=>
    string(1) "2"
  }
}

I passed this array into a view

$this->load->view('home/index',$news_data);

but I wanna use the data separately. I mean if I wanna use the second title or the second data. how can I express that in the view

thanks

Aucun commentaire:

Enregistrer un commentaire