Hi.
This is really a question only for those who have read Tom and Kevin’s book. I honestly wouldn’t bother unless you are fairly up to speed with this actual book :).
I have and I think I “get it” in terms of the IJDB Website. I am now looking closely at exactly how to use the framework for a new site.
My specific question is this: what “logic”, “rationale”, “thought process” should be applied when we ask ourselves the question “How should we divide up the functionality of our new site into controllers?”
I have identified (and please correct me if I’m wrong) that there are four elements that are project-specific: controllers, the routes, the database connection and all templates.
Templates are basically HTML layout; the database connection is just a case of credentials, the routes are essentially every possible page in the site but here we are getting into controllers as the route is a controller->method combo.
So, if I’m right, the real issue when taking the framework forward to a new site is “What controllers are required?” and the answer will help with our routes as well as, obviously, the controllers.
So. How to approach the division of the new site into controllers? I’m thinking… divide it up into “entities” (I will already have done this to an extent when I divided up the site’s data into tables in the database.) But is there more to it than this? I think so as the JokeController doesn’t just work with the jokes table: there are requirements on the authors table, so it’s not that black and white.
To help you think, let’s put together a hypothetical website from a high level perspective. Suppose my next site is for a business.
-
There will be “loose” pages such as contact form and T’s&C’s and location on a map. The kind of links you may find in a footer that lead to single pages.
-
There will be “grouped” pages such as “Services” (say, 10 different services with a page each) and “Courses” (say, 10 different courses with a page each). These will form the main navigation: “Services”, “Courses”, etc. which may lead to a landing page of 10 links to individual pages or which may have the 10 individual links in a nav drop down sort of thing.
-
There may be a “nested nav” situation. Let’s say “Vacancies” as a main link which leads to “Areas of Work” such as “Production”, “Analysis”, “Admin”. And each of these three has 5 jobs.
This, to me, is the “kind” of website I design, my bread and butter. So how to think about Controllers in this scenario: single unrelated pages, one-level groups, and two-level groups.
Hope that makes sense. I’m not asking for anyone to design a site for me :), just some pointers to the “logic”… how to “approach” it?
Cheers, guys.
Mike