Views and PHP Code

#11
[eluser]felyx[/eluser]
[quote author="Colin Williams" date="1233569738"]... or you can loop from the controller, calling a view on each iteration, and send the result to the view. ...[/quote]

I am not really familiar with this solution can you give me an example of how you do this please? I always loop in my views when it comes to display data since I am fine with looping in views.. Smile

#12
[eluser]Colin Williams[/eluser]
Code:
$data['blog_posts'] = $this->blog->get_recent();
$data['posts'] = '';
foreach ($data['blog_posts'] as $post)
{
   $data['posts'] .= $this->load->view('blog/post_teaser', array('post' => $post), TRUE);
}
$this->load->view('blog/recent', $data);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.