Creating a template site with PHP

Templates should consist of 2 parts: getting data part and displaying data part.
While getting data, not a single character should be printed out.
If some errors occurred, display an error page.
Once you get all your data with no errors – it’s time to include a template. A template itself should be of 2 parts too: page template and common site template. By sorting things this way you’ll solve all your present and future templating problems.

A typical script may look like

where template.php is your main site template, including common parts, like header, footer, menu etc:

and links.php is the actual page template:

easy, clean and maintainable.

settings.php contains all common settings:

Leave a Reply

Your email address will not be published. Required fields are marked *