Then you will need to create an array to loop over manually
eg.
$referer = array("Unknown",
'Internet" => array("Google", "Yahoo"),
"Radio" => array('KUSF', 'KFRC')
);
And then in the view
<select>
<?php foreach ($referer as $group => $items){
if (is_array($items)) { ?>
<optgroup LABEL="<?= $group; ?>">
<?php foreach ($items as $value) { ?>
<option LABEL="<?= $value; ?>" value="<?= $value; ?>"><?=
$value; ?></option>
<?php } ?>
</optgroup>
<?php } else {
<option LABEL="<?= $items; ?>" value="<?= $items; ?>"><?=
$items; ?></option>
<?php }
} ?>
(Not verified but should be close)
Geoff
--
http://lemoncake.wordpress.com
On Jul 3, 6:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> For most purposes, generateList seems the way to go, but I want to
> write the select directly in the view with $form->select() .
>
> On Jul 2, 12:42 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > This is from the Bakery code.
>
> > $this->set('parents', $this->Category->generateList(null, null , null,
> > null, null,'{n}.ParentCat.name'));
>
> > The last param is the what you want to group on and will have that
> > label.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---