Is the name field a varchar255 not null or tinytext? Try using cake bake to create your starting environment and work from there
On May 15, 5:38 pm, number9 <xpozit...@gmail.com> wrote: > Actually I tried displayfield earlier when I was searching, but it > didn't work, presumably because: "The model will use name or title, by > default." and I am trying to output "name" (so it should be doing that > anyway). > > On May 15, 4:33 pm, number9 <xpozit...@gmail.com> wrote: > > > OK, so I tried setting recursive to two again (didn't work earlier) > > and it worked! > > > Is there a better method to do this for future reference as it seems > > to place a bit of a load of the database... > > > On May 15, 4:12 pm, number9 <xpozit...@gmail.com> wrote: > > > > Hi all, > > > > Apologies for this newbish question, I've searched for hours trying to > > > resolve this with no joy so would appreciate it if you could point me > > > in the right direction. > > > > I'm trying to setup a simple website (my first cakephp project, having > > > become OKish at PHP/MYSQL). > > > > Basically there are three models so far, posts, categories and sites > > > (all of the databases follow cake naming conventions, with id as PK, > > > name and _id for FKs. > > > > Posts belong to categories. > > > > Posts also belong to sites. > > > > Categories, and sites have one post. > > > > I have used cake bake to generate the controllers and views. /posts/ > > > works great, and it shows everything by name, the "add" works great in > > > terms of the relationships. > > > > The problem I am having is, when I go to /categories/, it brings up > > > posts under that category and the "category" and "site" are showing up > > > as numbers rather than "name" (in the view they are category_id, and > > > site_id). I can get the category name to show up OK (because I think > > > that table is mapped). > > > > What I don't understand is why the name is not showing in place of the > > > _id like everwhere else. How can I output database fields in another > > > model. It is probably something really simple, but I'm getting used to > > > the cake way of thinking. > > > > Is it that the relationship is wrong? The query at the bottom shows > > > the "names" are being selected. > > > > Thanks in advance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~----------~----~----~----~------~----~------~--~---