Re: Querying the database in a view
I completely agree with what clearflysystems says... even the Js (Ajax)
helper does not break this convention since it usually collects its data
to display from a controller action.
The Model/View/Controller pattern is a very well documented pattern
which attempts to separate data, control and display functionality. If
code does not stick to this design then there seems little point in
using an MVC framework in the first place.
On Sat, 2011-01-22 at 07:19 -0800, clearflysystems@googlemail.com wrote:
> But what about when it breaks and you or someone else has to fix it
> and you can't remember what you did and where?
>
> Conventions are there for a reason, frameworks are designed to help
> you code efficiently but only work efficiently when you follow those
> conventions.
>
> Helpers are View Helper Classes for manipulating the Display of data
> passed to them from the Controller.
>
> All you need is something like this in your controller:
> $this->set('myoptions', $this->MyModel->find('list') );
> http://book.cakephp.org/view/1022/find-list
>
> Then in your View
> echo $this->Html->input('SelectboxName', array('options' =>
> $myoptions) );
>
>
>
> On Jan 21, 7:35 pm, Unflexible <unflexi...@gmail.com> wrote:
> > 2011/1/21 AD7six <andydawso...@gmail.com>:
> >
> > > On Jan 21, 12:35 am, Unflexible <unflexi...@gmail.com> wrote:
> > > Hideous.
> >
> > Sure, but it works
>
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home