Re: Structual controller question
Hi Guys, Thanks for the answers. So do I understand it right, Either add it to the user_controller or the recipe_controller. So you guys would drop the idea of having a mybox controller than, even if I have a mybox table where I store the IDs of the recipes a user watches. So from my feeling I would think that the mybox section should be than in the user_controller. Are there any other thoughts maybe? I look forward to any feedback. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Structual controller question
I'd put the method in RecipesController. Just grab the user_id from the session (or Auth). Or, if you want people to be able to see other users' recipes: function yourAction($user_id = null) { if (is_null($user_id)) { $user_id = $this->Auth->user('id'); } ... } On Wed, Jul 8, 2009 at 11:16 AM, Luke wrote: > > Hi, > > I am developing a small recipe site, this is my first cakePHP project. > I now have a structual question. > > You have to register and log in to add a recipe. So in the recipe > table will be your user_id. You can also save recipes in your > cookbook. To see your saved and your own recipes, you have to log in > into your I call it "mybox". > Question now, I want to display a list of your own recipes as well as > your saved recipes in your mybox. > > Do I now create a mybox controller which reads out the recipe table > for your own recipes and read out the mybox table or do i actually add > a function in the user controller to read out the mybox and recipe > table? > > Means, does mybox belongs to the User_controller and I dont create a > seperate controller or should I treat it seperate? > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Structual controller question
Luke, At first glance, I would create a method Recipe::FindUserRecipes ($user_id). In it, you can set your conditions and bind to get the list of recipes associated with the user. I hope that makes sense. BTW - I have a similar website in development. http://www.greatcajuncooking.com -teh On Jul 8, 10:16 am, Luke wrote: > Hi, > > I am developing a small recipe site, this is my first cakePHP project. > I now have a structual question. > > You have to register and log in to add a recipe. So in the recipe > table will be your user_id. You can also save recipes in your > cookbook. To see your saved and your own recipes, you have to log in > into your I call it "mybox". > Question now, I want to display a list of your own recipes as well as > your saved recipes in your mybox. > > Do I now create a mybox controller which reads out the recipe table > for your own recipes and read out the mybox table or do i actually add > a function in the user controller to read out the mybox and recipe > table? > > Means, does mybox belongs to the User_controller and I dont create a > seperate controller or should I treat it seperate? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Structual controller question
Hi, I am developing a small recipe site, this is my first cakePHP project. I now have a structual question. You have to register and log in to add a recipe. So in the recipe table will be your user_id. You can also save recipes in your cookbook. To see your saved and your own recipes, you have to log in into your I call it "mybox". Question now, I want to display a list of your own recipes as well as your saved recipes in your mybox. Do I now create a mybox controller which reads out the recipe table for your own recipes and read out the mybox table or do i actually add a function in the user controller to read out the mybox and recipe table? Means, does mybox belongs to the User_controller and I dont create a seperate controller or should I treat it seperate? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---