CodeIgniter Forums
[newbie] help with passing variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [newbie] help with passing variables (/showthread.php?tid=57887)



[newbie] help with passing variables - El Forum - 04-23-2013

[eluser]Unknown[/eluser]
I have a simple view that uses a database query to retrieve information from a table called "posts"

Code:
<?php foreach($posts as $post) { ?>

<?php echo $post->email; ?>
  
<?php if (is_subscribed($post->id)) {

echo "Subscribed";

?>

    
  <? } ?>

As you can see I'm using a function in my view.
That function queries another table and using the id, returns a true/false.

From my understanding, placing functions in the view is bad practice. How can I achieve the same result by placing it in a controller?