Update footer on many sites from one file/location

Discussion in 'Programming' started by rednimer, Jul 24, 2010.

  1. #1
    I have a bunch of sites with links in the footer that are all the same. I want to set something up so I can update all of the links from one place.

    I was thinking maybe like a text file that I update, and all of the sites read the text and pull the links from it, or something.

    I would do an iframe, but then I cant track clicks, so that wont work.

    Any advice would be great.

    Thanks
     
    rednimer, Jul 24, 2010 IP
  2. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #2
    footerLinks.php (the file on the master server, which all other sites can access)
    <?php
    echo '<a href="http://google.com">Google</a>';
    echo " | ";
    echo '<a href="http://who.is">Whois</a>';
    ?>
    PHP:
    footer.php (the file that holds the footer information right now)
    <?php
    ...
    echo file_get_contents("http://location.us/footerLinks.php"); // Gets the footer file from the master server
    ?>
    PHP:
     
    iAreCow, Jul 24, 2010 IP
  3. Cozmic

    Cozmic Member

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #3
    Why did you make footerlinks.php a .php file? It could as easily have been .html and probably would do about the same thing. Also, if you have everything on one server, you can use the require_once() function with a relative file path to include the file.
     
    Cozmic, Jul 25, 2010 IP
  4. VideoWhisper.com

    VideoWhisper.com Well-Known Member

    Messages:
    330
    Likes Received:
    6
    Best Answers:
    2
    Trophy Points:
    113
    Digital Goods:
    2
    #4
    That could slow down page load because server has to download the footer first.
    You should implement a cache system that saves footer in a local file and displays from there until it expires.
     
    VideoWhisper.com, Jul 25, 2010 IP
  5. rednimer

    rednimer Well-Known Member

    Messages:
    455
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Thanks, that was exactly what I was looking for.

    Ill give it a try this evening.
     
    rednimer, Jul 25, 2010 IP
  6. rednimer

    rednimer Well-Known Member

    Messages:
    455
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    120
    #6
    seems to work as expected, thanks again!
     
    rednimer, Jul 25, 2010 IP