grigri said:
"You can also use "{1} {2}" as the format string instead of the
sprintf() format, if you like. Personally I prefer the sprintf
format..."
Yeah, but if You have something like:
Array
(
[0] => Array
(
[Company] => Array
(
[name] => NetArch sp. z o.o.
)
[CompanyAddress] => Array
(
[city] => Krak�w
)
)
[1] => Array
(
[Company] => Array
(
[name] => Firma2000
)
[CompanyAddress] => Array
(
[city] => Warszawa
)
)
[2] => Array
(
[Company] => Array
(
[name] => Husqwarna
)
[CompanyAddress] => Array
(
[city] =>
)
)
[3] => Array
(
[Company] => Array
(
[name] => SuperOkna
)
[CompanyAddress] => Array
(
[city] =>
)
)
[4] => Array
(
[Company] => Array
(
[name] => Ekstra Dachy s.a.
)
[CompanyAddress] => Array
(
[city] =>
)
)
[5] => Array
(
[Company] => Array
(
[name] => BSH gmbh
)
[CompanyAddress] => Array
(
[city] =>
)
)
)
and sometime CompanyAddress.city is supplied, and sometimes not, when
You use %s %s format, it results with empty values in returning array,
and warning:
Warning (2): vsprintf() [function.vsprintf]: Too few arguments [CORE/
cake/libs/set.php, line 352]
like:
Array
(
[1] => NetArch sp. z o.o. (Krak�w)
[2] => Firma2000 (Warszawa)
[3] =>
[4] =>
[5] =>
[6] =>
)
But when You use {0} {1} format, You'll have nice ouput. like:
Array
(
[1] => NetArch sp. z o.o. (Krak�w)
[2] => Firma2000 (Warszawa)
[3] => Husqwarna ()
[4] => SuperOkna ()
[5] => Ekstra Dachy s.a. ()
[6] => BSH gmbh ()
)
Cheers!
On 25 Lut, 18:03, aniston <[EMAIL PROTECTED]> wrote:
> this helped me too ! thanks grigri
>
> PS: If you have some time quote this simple example inhttp://book.cakephp.org/
> , I'm too new entry to explain the example.
>
> On Feb 11, 10:41 am, grigri <[EMAIL PROTECTED]> wrote:
>
> > find('list') only works with simple fields, you won't be able to do
> > this.
>
> > Still, it's easy enough with find('all') andSet::combine():
>
> > $people = $this->Person->find('all', array(
> > 'fields' => array('id', 'firstname', 'insertion', 'surname'),
> > 'recursive' => -1
> > ));
> > $list =Set::combine(
> > $people,
> > '{n}.Person.id',
> > array('%s %s %s', '{n}.Person.firstname', '{n}.Person.insertion',
> > '{n}.Person.surname')
> > );
>
> > On Feb 11, 9:25 am, roryy <[EMAIL PROTECTED]> wrote:
>
> > > Hello cakephp friends,
>
> > > I have 2 tables. Communications and people. In communications/add i
> > > want a list where you can choose one person from table people. But you
> > > don't see his name, only his ID. I have these fields in table people:
>
> > > id
> > > firstname
> > > insertion
> > > surname
>
> > > Can someone help me to make a list where you can see a persons
> > > firstname, insertion and surname with find('list' , .....) in the
> > > communication controller.
>
> > > Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---