PHP logo

PHP logo

One way to do more dinamyc our pages, write less code and simplifying the architecture of the files is using PHP.

You can use CSS3 to make the web coolest than others, but the content can be dinamized linking many files.

Imagine that you have a master ‘index.php’ with a space to include the content. You must create a script to attach only ONE, based in the URL variable petition.

<?php
if (empty($_GET)) {include 'index.inc';}

if (isset($_GET['contact'])) {include 'contact.inc';}
if (isset($_GET['about'])) {include 'about.inc';}
if (isset($_GET['gallery'])) {include 'gallery.inc';}
if (isset($_GET['documents'])) {include 'documents.inc';}
?>

First, we have a statement that include a default content (index.inc) if nothing was entered in the URL.

And then, we add a line for each petition we want to record. For example, if the URL is “…/index.php?gallery” the content must to be “gallery.inc“.