Re: Best practices question

2010-01-08 Thread Dr. Loboto
Just a little additions: // always have default value for action args to not receive missing argument errors function view($username = null) { if (!$username) { $this-Session-setFlash(__('Invalid User.', true));

Re: Best practices question

2010-01-08 Thread Foroct
Thank you that works like a charm. Usually when I write straight PHP I include an else statement but for some reason when doing this (my first cakePHP project) I did not do that. On Jan 8, 4:36 am, Dr. Loboto drlob...@gmail.com wrote: Just a little additions:         // always have default

Best practices question

2010-01-07 Thread Foroct
I have a users table and would like to view my users by username with a url like example.com/users/view/username In order to do that I have set my view function in my users controller to function view($username) { if (!$username) {

Best Practices Question

2009-03-03 Thread Dave Maharaj :: WidePixels.com
I have a controller USERS which displays a users profile. The profile data is comprised of information from various HABTM and hasMany tables in the database (PROFILE, AUTHORS, ARTISTS, QUOTES and so on) The user can edit all of their preferences / info on the profile page using AJAX. All of

Re: Best Practices Question

2009-03-03 Thread brian
I'd put as much as possible in its appropriate controller. And as much of the logic in the appropriate model. On Tue, Mar 3, 2009 at 4:47 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have a controller USERS which displays a users profile. The profile data is comprised of

Re: Best Practices Question

2009-03-03 Thread keymaster
I'd define the following basic crud operations operations in appController to work generically independant of controller/model: add(), edit(), del(), view() admin_add(), admin_edit(), admin_del(), admin_view() Then, all your profile controllers would inherit from appController, and:

Re: Best Practices Question

2009-03-03 Thread keymaster
Have a look at this: http://groups.google.com/group/cake-php/browse_thread/thread/7638b690ae0545ff/53a804265793ace3?lnk=gstq=crud# The more I think about it, the more sold I am on grigri's approach in the above thread. --~--~-~--~~~---~--~~ You received this

Re: Model best practices question

2007-02-15 Thread jinhr
If your Profile Model has already been defined $recursive = 1 or greater, then you can do in Controller: $this-Profile-unbindModel(array('hasMany' =array('user_image'))) before $this-Profile-findAll() This makes your Profile gets main_image, but no user_image. Keep in mind the unbindModel

Model best practices question

2007-02-14 Thread mallyone
I'm trying to figure out how to return a list of users with only one user_image, the one with 'main'=1 in the user_images table. I also need to be able to return user.*, and it's associated images for another action. How should I handle this? Should I make another model called

Re: Model best practices question

2007-02-14 Thread jinhr
You can use $this-Profile-unbindModel(array('hasOne' =array('main_image'))) before $this-Profile-findAll() On 2月14日, 下午5时21分, mallyone [EMAIL PROTECTED] wrote: I'm trying to figure out how to return a list of users with only one user_image, the one with 'main'=1 in the user_images table.