Usually I have the main page (index.php) that include header/footer/menu and the content of the page. The content is changed checking some variable from the GET/POST method: for each condition, I load the page requested.
Somethings like :
website/
website/index.php?explore=forum
website/index.php?explore=users
website/index.php?explore=articles
and so on…
Now, my website is growing, and I think the best way is to call directly a “index” page for each section; so for example above, this will be traslate as :
website/
website/forum/
website/users/
website/articles/
that looks better, and is more confortable to manage! The problem is that, if I do this, I need to implement the contour for each zone (that include header/footer/menu).
So I don’t know if there are a better strategy and if its convenient. Any suggestions/opinions is welcome! Thanks
In our projects that are straight PHP (no framework like Symfony or whatever), we definitely have different directories and separate index files for each section, like you say.
But we generally just have one header include file, and one footer file, that applies to every page on the site. That keeps the header and footer consistent, and more manageable.
You can always include the header and footer with a line like
if you want to keep those files in their own directory. I think we actually have /includes on our include path so our lines just say