![]() |
data passed to view - using objects rather then arrays - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: data passed to view - using objects rather then arrays (/showthread.php?tid=44008) |
data passed to view - using objects rather then arrays - El Forum - 07-30-2011 [eluser]CI2RULZ[/eluser] passing data $data = array( 'title' => 'My Title', 'heading' => 'My Heading', 'message' => 'My Message' ); $this->load->view('blogview', $data); And here's an example using an object: $data = new Someclass(); $this->load->view('blogview', $data); can someone post an example of a controller file with Someclass being used to define the title, heading, and message? the example above is provided in documentation, but without context. data passed to view - using objects rather then arrays - El Forum - 07-30-2011 [eluser]fesweb[/eluser] You can use a standard object like this: Code: $data = new stdClass(); Code: $this->db->where('id', $id); |