Search This Blog

Thursday, September 16, 2010

Master page for the Website

Since myself and Dharmil are the web masters for the WISE team, we have decided to recode the website. We thought the current website was slow since it uses Flash. We decided to use PHP, Apache mod_rewrite for the website. We decided to have a masterpage templating system that which will help us in reducing the redundancy and makes it easy to modify files. Dharmil will help  me in doing this, since he has more experience. We will make a new file called .htaccess and the code would like:
1RewriteEngine On
2RewriteRule ^(.*).html$ index.php?paget=$1
So if any file is requested over the HTTP protocol, let’s say about.html, it will execute index.php?paget=about
Next we will have a PHP file which includes common headers/sidebars and the footers.
01
02include_once "header.html";
03 
04if(file_exists("page_{$_GET['paget']}.html") || ($_GET['paget'] ==''))
05{
06if($_GET['paget'] == '')
07{
08include_once "page_index.html";
09}
10else
11{
12include_once "page_{$_GET['paget']}.html";
13}
14}
15else
16{
17include_once "page_404.html";
18}
19 
20include_once "sidebar.html";
21include_once "footer.html";
22?>
Header, specific page, sidebar and the footer are also included. 

No comments:

Post a Comment