usually you have the counting part in the middle or the end:

$form->input('NodeDescriptor.'.$count.'.title');
or
$form->input('NodeDescriptor.title.'.$count);

this way you can properly iterate over it - depending on what you need
to achieve (multiple or singular input)

foreach ($this->data[NodeDescriptor] as $key => $value) {}
or
foreach ($this->data[NodeDescriptor]['title] as $key => $title) {}

i prefer the second way


On 18 Jun., 13:26, leo <[email protected]> wrote:
> This has me beat. I'm trying to create an array of fields in cakePHP
> 1.3 & PHP 5.3.2
> The array is zero based. On the first iteration, $count == 0. For some
> reason the string concatenation seems to convert this to null or unset
> which cake then interprets as "insert controller name here", viz:
>
>     for($count=0;$count<$num;$count++)
>     {
>        echo $form->input($count.'.NodeDescriptor.title');
>     }
>
> OUTPUTS (cleaned of fluff for clarity):
>
> <input name="data[NodeDescriptor][NodeDescriptor][title]" type="text"
> id="NodeDescriptorNodeDescriptorTitle" />
> <input name="data[1][NodeDescriptor][title]" type="text"
> id="1NodeDescriptorTitle" />
> ...
>
> I've tried casting the value, strval'ing it, single quotes, double
> quotes, double quotes and {} to no avail. Is this a PHP feature, a
> CakePHP unrobustness or me being dumb?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to