Today I tried a way to use my HTML Site in a new manner. Technically they are php files but nothing of PHP has been included. I just converted my HTML files to php and got a great portability.
Actually my site : www.adityastar.com was having a menu at the top on every page. So if I need to add even a single link in it then I would have to go through all the HTML pages mannually and this was a biggest trouble. So I broke up my HTML in three parts, First one Header, Second the body and third the Footer.
What I did,
created a header file with all the header portion plus the menu of my site.
Then I created a seperate footer file with the copyright information in it.
Lastly I created individual php files which contained the body material and in the begining it called for header file using include function and in the bottom the footer file using include function. Then the body of the individual HTML files were written in the individual php files.
This way I have a reusable header/footer file and customised body files for every content on my site.
Advantage of doing this :
1. I got a header file where I can simply add/remove or modify the menu/header by editing only one file
2. Footer can be customised with Google analytics and similar code by editing one file only
Disadvantage
1. I can not put current tag in any of the header link
Overall I found this method to be more helpful. You can check it out at www.adityastar.com
No comments:
Post a Comment