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:
2 | RewriteRule ^(.*).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.
02 | include_once "header.html" ; |
04 | if ( file_exists ( "page_{$_GET['paget']}.html" ) || ( $_GET [ 'paget' ] == '' )) |
06 | if ( $_GET [ 'paget' ] == '' ) |
08 | include_once "page_index.html" ; |
12 | include_once "page_{$_GET['paget']}.html" ; |
17 | include_once "page_404.html" ; |
20 | include_once "sidebar.html" ; |
21 | include_once "footer.html" ; |
Header, specific page, sidebar and the footer are also included.
No comments:
Post a Comment