The Php Template System.
Here Is where im going to explain the Veria code, its very simple and easy to
do it will allow u to have 2 files a header.html and a footer.html with which
you can update the entire look of the site by editing just these 2 files. The
system can also can be used with query strings which means you can essentially
have 4 files (header.html,footer.html,news.html, and core.php) for the entire
site!!!
Now the code below is very simple and i will try to explain the functions of each
tag as much as possible.
<?php
require('header.php');
$page = $_GET['page'];
if (($page == "home") or ($page =="")) {
include('news/news.php');
} else if($page == "projects") {
include('content/projects.html');
} require('footer.php');
?>
Ok first we take a look at the line require('header.php'); this line
means that when the php script loads it looks for the Header.php first thing (i
have a header.php for extra code but this isnt really needed so yours should just
be header.html) Make sure you put all of your html and other html-like code into
the header.html.
The next thing we see is
$page = $_GET['page'];
if (($page == "home") or ($page =="")) { include('news/news.php');
} else if($page == "projects") {
include('content/projects.html');
}
This means that it will GET the page which is set to home and include the news/news.php
(NOTE: im using fuzion news as my news client unless you want to use a similar
client it would be news/news.html) now youll also notice
else if($page == "projects"){
include('content/projects.html');
}
The else if($page == "projects") is using an else if which
means else if not home then show page == "projects" which would be a link of sorts
that would look like this (EX: ?page=projects) this would then show the html file
specified in the include('content/projects.html');
command.
You want more then one page of content u say? Well no problem all you have to
do is copy
else if($page == "projects"){
include('content/projects.html');
}
Put it directly underneath the prior else if command like so:
else if($page == "projects"){
include('content/projects.html');
}else if($page == "layouts"){
include('content/layouts.html');
}
Now you have 2 pages of content all you have to do now is create the html accordingly.
(Note: This process of copying and pasting the code can be repeated for an infinite
number of times for an infinite number of content pages, thus u only need one
php file (core.php) for your entire site)
I hope this Tutorial has helped u in someway or another!