Agreed, in this case, if it was me, I'd be using a helper. On Jul 12, 12:49 pm, kionae <[EMAIL PROTECTED]> wrote: > Alternatively, you could write up a helper that will not only either > grab the appropriate path or fill in the default, but also return it > in in a nice little img tag all ready to display in your View. Then > you wouldn't have to worry about duplicating the code the next time > you need to display an avatar in a different View. > > On Jul 12, 1:06 pm, Baz <[EMAIL PROTECTED]> wrote: > > > I'm new to Cake too, but this is one I believe I can answer. > > > As with many things, there is no right/wrong answer, but here's what I think > > would be best. > > > Most logic should be kept in the Controller and just a data dump in the > > view. So what you could do is populate your $this-data with the path for the > > avatar and in your view, just display whatever dump an image tag regardless. > > > Of course you could just as easily check the data in the view before you > > display with an "if", but convention would lean towards the former method. > > > On 7/12/07, Braindead <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I'm new to MVC development and at the moment I'm quiet unsure about V > > > and C. > > > > Let's assume I have a list of users in which I want to display an > > > avatar next to each user. If the user has no avatar I want to display > > > the default one. Both, the user avatar and the default avatar, are > > > stored in the filesystem. > > > > Here's my question: Where do I decide which avatar should be > > > displayed? Is it C because it's some kind of logic? Or is it V because > > > the avatar is part of the design? > > > > I'm unsure, because both would work, but I want to use the "correct" > > > one. > > > > Thanks, > > > Brain
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
