Up until now I’ve just used Yii as a back-end framework for building a CMS. In doing that, there’s been a very tight and clear relationship between the url in the application, the Controller and the Model.
Each model has its own controller and set of views - and the urls of the CMS match these closely.
Now that I’m building a complex front-end site, I’m finding that’s not the case.
For instance - a site might have these menu items
with a wide range of pages within each site section. "Products" might contain a testimonials page that pulls from a table of testimonials, and it might contain several text only pages that describe product generalities, return policy, etc… and these might pull data from a table of site pages. Then the product pages themselves will come from a product table, etc…
My question boils down to this: does the menu drive what’s in the controller, or the data?
Is the best practice to have one “Product” controller that deals with any page that’s under the “Product” section - and handles all the separate models - testimonials, site_pages, products?
this would make it simple to keep my urls consistent across "Product" pages: http://mysite/product/some_action
Or… should each controller be pretty much restricted to handling mainly one model - in which case I should be routing people to a separate testimonial controller, site page controller, and product controller. But then I’m stuck having to come up with some complex URL Manager rules to make sure that the urls still look like:
and this could get pretty convoluted.
Any ideas from the Yii community on what the best practice is here?