How to change 50 banners with one code?

Discussion in 'PHP' started by VINC, May 27, 2011.

  1. #1
    Even tho I just checked box that "I believe PHP is the BEST section for this topic" I have to say I am not sure at all. I just believe I will find the smartest people on this forum here ;-D

    I am looking for an advice how to change banner add without changing the actual code on site where banners is shown. What I mean is if I am running banner on 50 websites and I need to change it, I dont want to change manually the whole code on all 50 websites. Is there a way how to have this code in one place and by changing it there it will change it on all 50 sites?
    I hope you got what I am trying to say, thanks in advance.
     
    VINC, May 27, 2011 IP
  2. dazst

    dazst Active Member

    Messages:
    115
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    78
    #2
    Yes, include a javacsript to the site hosting the banner code.
    Then, when you change the banner code once, it changes on all your sites.
     
    dazst, May 27, 2011 IP
  3. TSelbeck

    TSelbeck Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Javascript is certainly an option.

    However, given that you've put it in the PHP section.. there is a PHP solution

    
    <?
    
    	header('Content-type: image/jpg');
    
    	echo file_get_contents('http://yoursite.com/image.jpg');
    
    ?>
    
    PHP:
    (not tested)

    Save that as a php file, obviously. Could rewrite it with htaccess to look like a .jpg/gif/whatever

    However.. surely there is the simplest of solutions you're missing here: you give the customers the URL to your image, say.. http://yoursute.com/image.jpg, and when you want to change the image on the 50 websites.. just overwrite http://yoursute.com/image.jpg with your new image...?
     
    TSelbeck, May 27, 2011 IP
  4. VINC

    VINC Member

    Messages:
    250
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #4
    thanks for your answers, I dont think the simplest solution you described can work for what I need. Lets say I have 3 websites:

    www.site1.com
    www.site2.com
    www.site3.com

    and all of them have banner ad which when you click you get on advertisers website. Now when I want to change this banner I dont wanna go to each website and change the code manually, I want somehow all my websites to be pointing to this one location where this banner is hosted so when I change the code there it will change on all my websites.
     
    VINC, May 27, 2011 IP
  5. TSelbeck

    TSelbeck Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ahh. So you're wanting to change the URL, and not the image. Right OK.

    So as suggested before, again - JavaScript would do the trick.

    A PHP method would be to have a text file.. called say.. advert.txt hosted somewhere.. which included say,

    <a href="http://advertising.com">Advertising</a>
    Code (markup):
    Then, on site1.com, site2.com and site3.com.. you could simply use

    
    <?
    echo file_get_contents('http://location-of-file.com/advert.txt');
    ?>
    
    PHP:
    Or if they're on the same server...
    
    <?
    echo include('/path/to/the/file/advert.txt');
    ?>
    
    PHP:
    Or, if you already have MySQL set up, you could perhaps link it to MySQL and grab the result from there.. and of course, will work on all 50 of your websites

    I say this, because you said "Lets say I have 3 websites".. so I'm assuming the websites are all yours. If the websites are not yours, then the easiest way would just be to use javascript (as people may not have PHP, may use ASP, just HTML, etc)
     
    TSelbeck, May 27, 2011 IP
  6. VINC

    VINC Member

    Messages:
    250
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #6
    Thanks for the time you are putting into this, could you do this for me and for how much? My knowlege of javascript or php is zero. Every site has 2 files topads.php and bottomads.php and these files contain the code for top and bottom ad banner. So I need to be able to control both these banners from one place. I do have mysql and all these scripts are running under one database. If you are interested you can send me PM, thanks again
     
    VINC, May 27, 2011 IP
  7. ttyler333

    ttyler333 Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #7
    This site or This one.

    If your willing to pay some $$ i'll make you one from scratch that'll be able to show rotated selections or be totally random ones. Just by changing $settings = "1" to $settings="2" ... of course i'd also explain the code inside so it'd be easy to make adjustments.
     
    ttyler333, May 31, 2011 IP