1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php code to include same thing in many websites

Discussion in 'General Programming Chat' started by antsaoo, Jun 17, 2009.

  1. antsaoo

    antsaoo Supreme Member

    Joined:
    Oct 1, 2008
    Messages:
    1,291
    Likes Received:
    637
    Good day, Iw been setting up few forums with FG and though about following.

    Would there be way use some code to put the same thing on all forums , Ie Adsense or change it to opt-in box or such so no need to go trough all forums.

    Also would it make adsense ads in accurate to content.



    Thnx
     
  2. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    you kinda mentioned it in your title use the php include command to insert common code from an external file

    i guess to elaborate, you save your adsense code to a file and the call it from each of your sites using the include statement

    so if you change your adsense code it will update across all sites...

    see here for more info:

    Code:
    http://us.php.net/manual/en/function.include.php
    http://www.w3schools.com/PHP/php_includes.asp
    http://www.tizag.com/phpT/include.php
    
    hth

    jay
     
    • Thanks Thanks x 1
    Last edited: Jun 17, 2009
  3. antsaoo

    antsaoo Supreme Member

    Joined:
    Oct 1, 2008
    Messages:
    1,291
    Likes Received:
    637
    Hmm. read all the tutorials and tried what they said, wonder if the problem is in hosting php version or so , hosting @ seo-hosting and the remote file would be at Hg

    i think this should have worked atleast ...

    Code:
    <?php
        include("http://www.domain.net/file.php");
    
        // Easy File Inclusion
    ?>
    remote file was php file with some text only in it
    need see more tomorrow, hopefully someone can post their thoughts on this :)

    thnx
     
  4. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    try renaming the file .inc

    if you can show the contents of the file too that would be helpful

    cheers

    jay
     
  5. tattoo

    tattoo Regular Member

    Joined:
    May 10, 2008
    Messages:
    405
    Likes Received:
    36
    Occupation:
    vagrant
    Location:
    mars
    Most hosts disable including remote files like that.
     
  6. ukescuba

    ukescuba Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 24, 2008
    Messages:
    994
    Likes Received:
    634
    Occupation:
    Mobile Marketer & QR Code Junkie
    Location:
    San Antonio, TX
    Home Page:
    see if it pulls in the file on the same domain to test it works

    then try remotely accessing it from a different domain and see what happens

    there are a few other options you could try but this is certainly the simplest

    alternatives would include sticking the info in a database and then pulling the data and displaying it

    just a thought...

    hth