I'm writing my own content management system for a personal website, it's going to be low traffic, but I'd like to use the best practices for my future knowledge.
My plan is to have separate sections, basically the first non-root directory, will have it's own script and will directly control all its subpages. I want everything to be controlled from a index.php in the root dir using mod_rewrite to make this transparent.
What would be the best way to load only what is needed for that section and not every other section as well? I was thinking about using a separate file for each section and naming it based on the URL that I'm using so I can include only that. But that hardly seems elegant. Is there a better way to accomplish this?