Re: View magic similar to form automagic
Thank you, your suggestion was helpful regarding joins. Ken -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: View magic similar to form automagic
When u call find method...second parameter is for params...you can use fields keu in this array and set which fields to use...look at cakephp book for this Dne nedelja, 12. februar 2012 je poĊĦiljatelj kdubya < kenwin...@winanstech.com> napisal: > Actually, the more I think about this I realize this cannot be done > with some magic in the view. I'll have to do it in the controller or > the model. Never mind. > > However, any suggestions of the best way to do this in the model or > controller would be appreciated. I can think of a SQL query using a > JOIN but I'm not sure how to force CakePHP to use a join in a model > association. BTW I'm using CakePHP 1.3 > > Ken > > -- > 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php > -- -- Lep pozdrav, Tilen Majerle http://majerle.eu -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: View magic similar to form automagic
Actually, the more I think about this I realize this cannot be done with some magic in the view. I'll have to do it in the controller or the model. Never mind. However, any suggestions of the best way to do this in the model or controller would be appreciated. I can think of a SQL query using a JOIN but I'm not sure how to force CakePHP to use a join in a model association. BTW I'm using CakePHP 1.3 Ken -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
View magic similar to form automagic
In section 7.3.3 of the manual, it talks about form automagic that is really cool and simplifies forms greatly. Specifically I'm talking about, the example of, in the controller doing: $this->set('groups', $this->User->Group->find('list')); and then in the form: echo $this->Form->input('Group'); This will create a multiselect form element assuming the table groups has id and name fields. The select will display the contents of the name field and the value stored in the table will be the id value for that row in the table. My question is: is there some similar view magic built in to CakePHP that when I just want to display the groups that the user belongs to (not in an edit form), that will output the contents of the name field instead of the id field. I know I can do the lookup myself and even put in an afterFind() or beforeRnder() call to do the conversion automatically, but, I was wondering if there was something built-in that I had missed? It would probably be an HTML helper call but I can't find it. Thanks, Ken -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php