As far as controller name conventions go, yes usually they are the plural name of the relative model, but this by no means restricts you to calling your controllers plural names or names of models present in your application. As far as im aware controllers can be named almost anything (besides the obvious clashes like AppController) and I frequently have a few controllers floating round my Apps (commonly a DashboardController for my general admin stuff) that do not follow the traditional conventions.
And as for requestAction, it does almost seem like a bit of a black sheep in that it's there to use, but more and more you here now "don't use requestAction" or at very least don't use it heavily and of course not without caching - generally when I use it I have the requestAction call made inside an element, with the element cached ( if not the whole view - caching the element separately allows you to specify a different expiry time to your view of course) More and more tough I have found myself (don't flame me for breaking conventions) in place of the requestAction calls using ClassRegistry::init to fire up a model, get my data direct and take care of the html right there in the element - just due to the nature of the last couple of apps we have done it worked best like this! Hope that helps! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of CakeAddict Sent: Tuesday, January 13, 2009 7:12 AM To: CakePHP Subject: Recommended Controller Class Name. Hello all, Based on what I have read from the documentation, the recommended way of naming your controller class is the plural form of the model they use. So if I have Post model then the controller class should be PostsController but what is the recommended name for a controller that does not use a model? For example, I wanted to have something like an Admin controller with actions like, addpage, removepage etc. Does that name break the CakePHP way? Does having /admin/addpage/3 lets say, breaks the CakePHP way of doing things? I would like to have a central location(controller) where I manage the content of the site pretty much instead of having page/add, page/edit etc for all my models. Also, according to the documentation using requestAction(this may not be the right name) is not a good idea to use inside controllers but If I want to have a frontpage that displays the lastest 5 items of something like news for example what is the alternative or correct way of doing it? Also the documentation states that it is not good idea to use this method without caching, does this mean caching in general or an specific caching method? Here is the quote from the documentation: "If used without caching requestAction can lead to poor performance. It is rarely appropriate to use in a controller or model." Any info would be very welcome. Take care. No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.10.6/1888 - Release Date: 1/12/2009 7:04 AM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
