Where I work, we are testing out CakePHP to replace our existing codebase.
I have two questions. 1. Do all primary keys for tables have to be 'id'? 2. I have 3 tables, blogs, posts, users. <b>blogs</b> <u>id</u> user_id title subtitle <b>posts</b> <u>id</u> blog_id user_id added updated text <b>users</b> <u>id</u> username password I want to be able to call http://www.mydomain.com/blog/view/cthompson and have it load a list of my posts. If I used http://www.mydomain.com/blog/view/1 it would automagicly know that I wanted to find the blog id = 1. The only way I could figure out to have to load based on username was to put a function in my app_model.php model file: function getUserId($username) { $ret = $this->query(' SELECT id FROM users WHERE username = "' . $username . '"'); return $ret[0]['users']['id']; } and call it in the blog_controller.php with $this->set('blog', $this->Blog->find(array('id' => $this->Blog- >getUserId($username)),null,null,2)); The recursive 2 seems to do nothing. I want it to pull in all the posts for this blog. So I tried calling this after it: $this->set( 'posts', $this->Posts->findAll(array('id' => $this->viewVars['blog'] ['Blog']['id'])), 'created DESC', null, null, null ); But when I do a foreach loop in my view.thtml file on the $posts var, nothing happens. We are still in the review stages of multiple frameworks, but think that CakePHP is the one for us. I would like to know if I am headed in the correct direction to get the information that I need to build a blog/view file with a list of all the posts that have been made to the blog. Thanks, Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---