All the code I outlined would be in the controller.  You could put the loop
in the getListData() function in the model if you like to keep the
controller cleaner.  The controller would then just be
$this->set('listdata', $this->Model->getListData());

Geoff

On 8/9/07, Beertigger <[EMAIL PROTECTED]> wrote:
>
>
> Somehow, this seems on the right track, but I couldn't get things to
> work. Played around with a lot of different variations, but
> *something* is not quite kosher, yet.
>
> Thanks much for the guidance thus far.
>
> Should the entire
>
> $data = $this->Model->getListData(); // a function in your model that
> does
> the custom query to pull the three fields you wnat to use
> $mylist = array();
> foreach ($data as $item){
>   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> $data['Model']['field3];
>
> }
>
> be in the Model?
>
> And the this->set in the controller?
>
> Sorry for my blatant stupidity. Wrapping what I know of php up with
> Cake is proving to be troublesome, at best. The masterbake script
> provides such a sweet basic framework that a bit of pain getting
> things 'just right' is worth it, but this one thing is really killing
> me... ; )
>
>
>
> On Aug 8, 3:48 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> > OK so use HtmlHelper::select() or selectTag() - I can't remember of the
> top
> > of my head which one it is.  My solutions is still the same - creat the
> > array that you want to display in the listbox manually.
> >
> > Again not sure of the exact array format but something like
> >
> > $data = $this->Model->getListData(); // a function in your model that
> does
> > the custom query to pull the three fields you wnat to use
> > $mylist = array();
> > foreach ($data as $item){
> >   $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' .
> > $data['Model']['field3];
> >
> > }
> >
> > $this->set("mylist", $mylist);
> >
> > Then in your view something like (again double check the format)
> >
> > $html->select("SelectName", $mylist, $selectedItems);
> >
> > I hope this helps :)
> >
> > Geoff
> >
>
>
> >
>


-- 
http://lemoncake.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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