How to build one click site wide change website?

Posted By: KP On May 9, 2009 Under Internet, Web Design, Web Master Categories


This tutorial shows how you can divide your site in such way that if you need changes in common things which are on all pages you just need to change a single file.Content on all pages will be changed.Its useful to build menus,newsbars,Site footer notes etc.

So basically we will keep all these things in a single file for each item and then we will include them in our php code.

Dynamic one click update menu

Dynamic one click update menu

In above image you can see on both sidebars content is common in all pages,On left there is navigation menu.The screenshot is from my personal website www.kunalpradhan.com

If I keep the menu code in normal html whenever I need to change  a single link of menu I will have to make changes on all pages.Same way on right hand if I need to update single news I will have to make changes in all pages.

Instead of this what we will do is we will take the common menu html code in one new file.

Lets name it “menu.php

Keep the file in the same directory on server where other HTML/PHP files are there.

Now in html replace your menu code by php code for including the menu.php file.

<?php

include “menu.php“;

?>

So on loading the page it will include the html code for menu which we have saved in menu.php

So now whenever you need a change in menu just make the change in menu.php The change will be applied to all pages automatically.

So in this way the funda of dynamic site works.This is not the dynamic site but its the use of code from file.



Share with Friends ( Sharing is Caring! )


Subscribe For E-mail Notification Of Article Updates

Enter your email address:

NOTICE:
DO NOT FORGET TO CLICK ON THE VERIFICATION LINK AFTER SUBSCRIBING,THE VERIFICATION MAIL WILL BE SENT TO YOU FROM "FeedBurner Email Subscriptions".
( What is this? Why I need to do this?)

Related Posts

Post a Comment

OR