Welcome Guest, Not a member yet? Register   Sign In
Retrieving data and displaying it in a view
#2

[eluser]m4rw3r[/eluser]
Use the second parameter of the Loader::view() method, passing the data in an array with the key as the name and the value as the data to pass.

Example:
Code:
// controller:
$post = $this->post->find(); // fetch from your model

$this->load->view('post/display', array('post' => $post));

// view:
<h1>&lt;?php echo $post->title ?&gt;</h1>
&lt;!-- etc. --&gt;


Messages In This Thread
Retrieving data and displaying it in a view - by El Forum - 09-02-2008, 05:24 AM
Retrieving data and displaying it in a view - by El Forum - 09-02-2008, 06:44 AM
Retrieving data and displaying it in a view - by El Forum - 09-02-2008, 07:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB