I'm still trying to figure cake out and I've a few questions, both about varying degrees of code re-use. Let me say first that I created the MVC for all of my database tables using bake.php. I must say, it is a *very* handy utility for those just learning.
1) Let's say I have 2 sections of my site. One is to display the site's user list and another to display the site's news. Both sections are working and has the layout just how I want it. Yay, go me. Now I want to add a 3rd section to my site. Let's call it "What's New". On that page, I want it to show only the last 2 news items and the 5 newest members. Now, I could create the view for this page by copying and pasting the code from the view for the other 2 sections (news, users), but if I make a layout change to one, I have to also make it on the other. I'm sure you can see where I'm going with this. Is it possible to tell a controller to use multiple views? It's own and also any other? 2) When using bake.php, it creates the basic CRUD actions. Even if you don't use bake.php, the MVC principle (as it relates to a DB driven site) encourages that you create your own CRUD actions. I have a slight issue with this (in general) and also how bake.php goes about creating the actions (more specifically). When implementing the actions for the "C"reate and "U"pdate actions, it creates 2 separate methods in the controller. Why? They are both essentially performing the same action. The only difference is whether or not the form fields are pre-filled and whether it is an UPDATE or an INSERT query once the form is posted. The existence (or not) of the primary key can be used to control that behavior. Why have that redundant code; why have 2 methods/actions that look practically identical? thnx, Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
