Can I put my ad codes in a text file and call them from there?

Discussion in 'PHP' started by 5ive, Oct 10, 2008.

  1. #1
    Hi..


    As title says, Is it possible to put the ad codes into a text file and call them from there?? I mean I dont want to edit the sites HTML/PHP files all the time, can I just create a text file where i can put my ad codes and call them from there?? If this is possible, how do I do it. Please Im not so good coder :eek:
     
    5ive, Oct 10, 2008 IP
  2. rhoula

    rhoula Well-Known Member

    Messages:
    875
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    145
    #2
    Can you send a sample of the ad code you want to save in the text file, thank you
     
    rhoula, Oct 10, 2008 IP
  3. mehdi

    mehdi Peon

    Messages:
    258
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes you can create a text file maybe 'adblock1.txt' and write your adcode in this file, save this file in same directory or any where on your website.
    In any file of PHP where you want above adcode to appear just add this line:

    
    <?php
    include("adblock1.txt");
    ?>
    
    PHP:
     
    mehdi, Oct 11, 2008 IP
  4. definitely

    definitely Well-Known Member

    Messages:
    520
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Try putting up the ad.txt ile onto the server then say:

    <?php
    include("ad.txt");
    ?>
     
    definitely, Oct 11, 2008 IP
  5. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #5
    there is no problem i feel its just include statement
     
    chandan123, Oct 11, 2008 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    Yes include can doo that .. Include function doesnt require he file to be php only
     
    Bohra, Oct 11, 2008 IP
  7. GuitarFix

    GuitarFix Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think the right way is this:
    echo file_get_contents( 'ad.txt' );
    PHP:
    Put your ad code in ad.txt.
     
    GuitarFix, Oct 11, 2008 IP
  8. 5ive

    5ive Well-Known Member

    Messages:
    1,348
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    185
    #8
    Thanks a lot guys, this will save a lot of time for me.. Will try this and let you see how it become :eek:
     
    5ive, Oct 11, 2008 IP