Usually I've the primary page (index.php) which include header/footer/menu and also the content from the page. This content is transformed checking some variable in the GET/Publish method: for every condition, I load the page asked for.

Somethings like :


and so forth...

Now, this site keeps growing, and i believe the easiest way would be to call directly a "index" page for every section so for instance above, this is traslate as :


that appears better, and it is more confortable to handle! However ,, basically do that, I have to implement the contour for every zone (which include header/footer/menu).

So I'm not sure if you will find a much better strategy and when its convenient. Any suggestions/opinions is welcome! Thanks

You can get the underside result using the top strategy by doing apache rewrites. For instance, /forum might be re-written to visit and so on.

Here's the entire guide:

Take a look at an MVC framework like Symfony (PHP), Rails (Ruby) or Django (Python).

Within the MVC design pattern, you normally have one front controller which handles all of the loading. You've models which communicate with your computer data sources, and you've got sights which define the interface. Remotes load data through the models, after which pass those to sights.

Inside your example, each section might have another controller, and various interaction types (the most typical being create, list, remove, edit) have different actions.

You can only use .htaccess rewrite rules to redirect individuals nice-searching Web addresses to some single index.php file.

The only issue is the fact that you'd need to develop a means of distinguishing the Web addresses to redirect (website/forum/, website/users/, etc.) in the normal ones (website/css/, website/images/, etc.).

You will find some options:

  1. Rather than using website/[pagename]/, you could utilize website/page/[pagename]/. Your regex could just redirect every URL that suits ^/?page/[\w+]/?$ to index.php?explore=[pagename]
  2. Just clearly list every page that you would like to redirect make use of a regex like ^/?[forum|users|articles]/?$
  3. Don't be concerned about this. If you are only redirecting Web addresses that do not incorporate a file title, when you do attempt to reference CSS or images (i.e., Web addresses that do incorporate a filename), it should not be an problem.

Within our projects which are straight PHP (no framework like Symfony or whatever), we certainly have different sites and separate index files for every section, as if you say.

But we generally simply have one header include file, and something footer file, that is applicable to each page on the website. That keeps the header and footer consistent, and much more workable.

You could range from the header and footer having a line like

<?php include('../includes/head.php'); ?>

if you wish to keep individuals files in their own individual directory. I believe we really have /includes on our include path so our lines just say

<?php include('head.php'); ?>