i dont like using helpers for that it usually restricts the access to the view
libs, components or model methods are more generically usable especially if you think about it: isnt't it almost always(!) related to at least one model? like jeremy's example with genders to the user model i simply put them in the corresponding models http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ but if its just SOME array not related to anyone you could use libs or components to keep it dry while still being able to use it in model (for validation maybe) or any controller method as well. On 18 Mai, 22:20, Miles J <[email protected]> wrote: > I suppose the only upside of a helper is not having to place it > everywhere its needed in the controllers, just call the helper :P > > On May 18, 1:01 pm, Jeremy Burns | Class Outfit > > > > > > > > <[email protected]> wrote: > > Doesn't that just move it? If it's that static (e.g. 'm' => 'Male', 'f' => > > 'Female') putting it in an array variable seems fine to me. > > > Jeremy Burns > > Class Outfit > > > [email protected]http://www.classoutfit.com > > > On 18 May 2011, at 20:41, Miles J wrote: > > > > I guess it depends what the options array is used for? If it is never > > > associated with a model, than you can create a helper. > > > > $this->Helper->getOptions(); > > > > On May 18, 11:46 am, Jason Mitchell <[email protected]> > > > wrote: > > >> I have in a controller an array containing data used on the view to > > >> populate > > >> a drop down. I put it on the controller, so the array could be used by > > >> multiple views associated with that controller (create, edit). > > >> Additionally, > > >> it means that if I do ever have to change it, I just have to change it > > >> once > > >> (yup, lazy). > > > >> Because the data is relatively static, and is used in only isolated > > >> instances, it didn't seem to be worth the effort of creating a model for > > >> that data, and establishing a relationship between models. And, putting > > >> it > > >> on the controller, worked. > > > >> Admittedly, I'm new to MVC, but this really doesn't seem to jive > > >> definition. > > >> Am I doing something wrong? If so, how would one but this on the model, > > >> short of some sort of association with another model? > > > >> -- > > >> J. Mitchell > > > > -- > > > Our newest site for the community: CakePHP Video > > > Tutorialshttp://tv.cakephp.org > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > others with their CakePHP related questions. > > > > To unsubscribe from this group, send email to > > > [email protected] For more options, visit this group > > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
