How can I avoid using foreach in a view? |
[eluser]victorche[/eluser]
I've read a lot about pros/cons of using foreach in a view file. Even according to this thread: http://ellislab.com/forums/viewthread/170579/ Using of foreach is something good ... But let me explain the problem. I am having an array of data, which should be displayed in a view. This data is taken from the database directly but I want to change some of the values, to be ... more human let's say. So the first case is to use foreach in the view like this: Code: <?php foreach ($received as $row): ?> Code: $received = $this->tasks->received_tasks($user_id); It is really hard for me to understand why we have to do the loop in the view files. Can I somehow avoid this? Or how can I use these nice helpers if the loop is in the view? Please, give advice ![]() |
Messages In This Thread |
How can I avoid using foreach in a view? - by El Forum - 01-27-2011, 09:20 AM
How can I avoid using foreach in a view? - by El Forum - 01-27-2011, 11:57 AM
|