469,326 Members | 1,351 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

Best way to update website

114 100+
Hi Friends,

I have two HTML websites and I am regularly making lots of changes in one of them. Now I want the 2nd website should be updated automatically so that I don't need to update the website twice.

Here are two websites:




The only difference in both websites is the header and footer. Rest everything is the same.

I want that when I make any changes in example.com, it should automatically updated in php.net but I need to keep header and footer different for both the websites. The rest of the content should be the same for both websites.

Please help me on this and advise how can I do this?


Feb 20 '09 #1
5 3606
1,168 Expert 1GB
Well you could just have two footer/header files and store them each in their own website folder and basically just have all your content in one file (and your headers/footers in separate ones) and then include all the files like this:
For webiste 1:
Expand|Select|Wrap|Line Numbers
  1. include( 'header.php');
  2. include( 'content.php');
  3. include( 'footer.php');
For webiste 2:
Expand|Select|Wrap|Line Numbers
  1. include( 'header.php');
  2. include( '../website_1/content.php');
  3. include( 'footer.php');
This is assuming your websites are on the same server and in the same folder (eg public_html). So each website calls the header.php and footer.php in it's own directory, but both websites call the content of website 1. I hope that made sense.
Feb 20 '09 #2
8,651 Expert Mod 8TB
if you have both domains on different servers you may as well use an ftp client that is able to sync folders. though it's not done automaticly it's just 2 or 3 clicks.
Feb 20 '09 #3
You can use iFrames :)
Mar 1 '09 #4
6,050 Expert 4TB
Or, I'm just throwing it out there, you could try using a database and take the pain of having to edit files directly away? That makes the most sense.

Expand|Select|Wrap|Line Numbers
  1. $page->get_header();
  3. $page->get_content();
  5. $page->get_footer();
$page->get_content would make a request to your database (perhaps through a model) for the content, preparing it for display.
Mar 1 '09 #5
6,050 Expert 4TB
iframes are bad. Go the server route.
Mar 1 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Jaunty Edward | last post: by
1 post views Thread by revolnip | last post: by
2 posts views Thread by Stephen Brown | last post: by
5 posts views Thread by Rudy | last post: by
1 post views Thread by Faybe1989 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.