There are a number of ways to solve this. You can use inheritance, or parameters, and setup routes for the parameters.
Venue1NewsController extends NewsController or NewsController::news($venueNumber,$moreParams) I don't think copy+paste is the right solution though. -Mark On Jun 2, 9:40 pm, double07 <br...@bluenectar.com.au> wrote: > Hi All, > > I'm working on a project at the moment which has a main site then sub > sites for venue franchises. The venue sub sites are effectively the > same as the main site but the news items etc are filtered to be only > for that particular venue. > > The way I have this setup at the moment is as follows (I'll use news > as an example): > -Just a standard news model > -a main controller for news news_controller.php > -a sub controller for each venue i.e. venue1_news_controller.php - > this is the same as the normal news controller except it has a > condition to filter only news items for 'venue1' > -normal news views > -a venue1 sub folder in news containing slightly different views > (mainly to add a hidden venue id field when adding news so when a > venue1 editor can only add news for venue1) - accessed in the venue1 > news controller via changing the view path > -Then I have routes setup ie: Router::connect('/venue1/news/:action/ > *', array('controller' => 'venue1_news')); > > Now this all works perfectly fine. However, what concerns me is the > amount of times I'm effectively repeating things which are - bar a few > small differences - doing essentially the same thing. Also, if I have > to make changes to the news controller I effectively have to update > each sub controller too. > > I'm just wondering if this is the best way to go about things? Is > there a better way where I could have only one news controller/set of > views but somehow add the conditions for the venues on the fly or > something? > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---