This is all well and good, in this specific example ... but the
underlying principle still exists: better OOP layout.

On Sep 23, 5:32 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> >  Even if `afterFind()` is used, I'd still be doing 1 more loop than I
> >  should need to.
> >  But thanks for the tip, it's all very useful.
>
> If you have logic that you need in the view, create a helper and add
> methods to it, like:
>
> // /app/helpers/ecom.php
> class EcomHelper extends Helper {
>
>         public function calculate_totals($record)
>         {
>                 # do stuff
>         }
>
> }
>
> // A view of some sort
> foreach($data as $row):
>         echo $Ecom->calculate_totals($row['Model']);
> endforeach;
>
> Though personally I would do this in the afterFind.
>
> jb
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to