1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Ad Network on static HTML site

Discussion in 'Co-op Advertising Network' started by midan, Mar 14, 2005.

  1. #1
    Hello All,

    I created an account on Digital Point's Coop Advertising Network but my site is entirely static HTML (well, for the most part).

    I do have php support on the server but how can I make the advertisement show up in the footer when all my pages are in HTML format?

    Thanks for your help,
     
    midan, Mar 14, 2005 IP
  2. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Create a file named passthru.php with the following code: (Change the purple part to fit your .css theme)
    <?php
    
    if (!function_exists('file_get_contents')) {
    function file_get_contents($url) {
    $handle = fopen($url, 'r');
    $string = fread($handle, 4096000);
    fclose($handle);
    return $string;
    }
    }
    
    include ('ad_network.php');
    echo preg_replace ("/<\/body>/i", '<[COLOR=DarkOrchid]DIV align="center" class="style30"[/COLOR]>' . $ad_network[0]. '    ' . $ad_network[1]. '    ' . $ad_network[2] . '    ' . $ad_network[3] . '    ' . $ad_network[4] . '</div></body>', file_get_contents(str_replace ('../', '', $_REQUEST['file'])));
    ?>
    Code (markup):
    Create an empty file named ad_network_ads.txt in the same directory. The web server user should have write permissions to this file.

    change your .htaccess or add one in the root directory to this (save any information from your old .htaccess)
    AddHandler application/x-httpd-php .htm .html
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} ^(.*).htm [NC,OR]
    RewriteCond %{REQUEST_FILENAME} ^(.*).html [NC]
    RewriteRule ^(.*) /passthru.php?file=$1
    </IfModule>
    Code (markup):
     
    kyle422, Mar 14, 2005 IP
    digitalpoint and unprofundity like this.
  3. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I added all the above files and ad_network.php file. Ads no show, no validate.

    Then I tried changing naming with ad_network_217 in all places mentioned...didn't help.

    If I remove files I can generate error messages at the top of the pages...so at least I know I exist! (Beats sitting in a stove all day)

    I'm not sure if I can post urls yet but it may help. usgardening dot biz
     
    jazzylee77, Apr 5, 2005 IP
  4. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I just noticed I'm getting a bit of something at the bottom of the left column

    r" class="style30">Y o u m

    I'm guessing I need to change where it is trying to insert? Not sure how to do that...the error messages were appearing above the banner, which would be a visual negative for the site if thats where the ads ended up too. Hoping someone is feeling helpful! Otherwise I'll stick to adding it to a couple phpBB sites. :)
     
    jazzylee77, Apr 5, 2005 IP
  5. Cygnus

    Cygnus Cat Herder

    Messages:
    172
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Using the new ad_network; just update for the correct file names...

    .htaccess

    AddType application/x-httpd-php .php .htm .html


    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} ^(.*)\.htm [NC,OR]
    RewriteCond %{REQUEST_FILENAME} ^(.*)\.html [NC]
    RewriteRule ^(.*) /passthru.php?file=$1
    </IfModule>




    passthru.php

    <?php

    if (!function_exists('file_get_contents')) {
    function file_get_contents($url) {
    $handle = fopen($url, 'r');
    $string = fread($handle, 4096000);
    fclose($handle);
    return $string;
    }
    }

    include ('ad_network_182.php');
    echo preg_replace ("/<\/body>/i", '<br><div class="main" style="padding-left:12px; padding-right:12px">'. $ad_network . '</body>', file_get_contents(str_replace ('../', '', $_REQUEST['file'])));

    ?>
     
    Cygnus, Apr 5, 2005 IP
    unprofundity likes this.
  6. Googles76

    Googles76 Peon

    Messages:
    664
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I also have mostly static html (.htm) files and it works with the new ad network code. Just follow the insturctions for PHP based ads and it will work as long as your server has php support
     
    Googles76, Apr 5, 2005 IP
  7. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok thanks to both. I'll give it another shot.
     
    jazzylee77, Apr 5, 2005 IP
  8. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #8
    now I'm getting the error message

    You must set the ad network .txt file to be writable.

    I have a blank ad_network_ads.txt file that is set to 666
     
    jazzylee77, Apr 5, 2005 IP
  9. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I've got it set up without the _217

    are those numbered parts of the file names necessary for some reason?
     
    jazzylee77, Apr 5, 2005 IP
  10. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I put the number back in the file names and in its mention in passthru and it works...

    I think the only change from what I was trying before was the line in .htaccess
     
    jazzylee77, Apr 5, 2005 IP
  11. kyle422

    kyle422 Peon

    Messages:
    290
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Glad you got it working. I was having some problems with my site after the update. It just started working without any changes. LOL
     
    kyle422, Apr 5, 2005 IP
  12. Cygnus

    Cygnus Cat Herder

    Messages:
    172
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    108
    #12
    Welcome to the HTML version.
     
    Cygnus, Apr 5, 2005 IP
  13. unprofundity

    unprofundity Peon

    Messages:
    45
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #13
    thanks for this thread it helped me setup the coop ads on my html pages but all the html pages uses ssi navigations, headers and footer .txt files. when i do this modification it shows the ads but the original .txt ssi is not visible. what modifcation is necessary so that i can show both the original .txt ssi navition links and the coop ads?

    thank you in advance!
     
    unprofundity, Oct 30, 2005 IP
  14. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I hit this problem also with SSI. I was just adding some quotes to my footer. I don't know how to fix it, but the problem seems to be in the .htaccess part that relates to passthru.php.

    I know I need a better understanding of regular expressions.
     
    jazzylee77, Dec 2, 2005 IP
  15. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #15
    :) Before I laugh at any newbies, I need to go read some of my posts around my join date. Funny how everything is simple once you understand it. ;)
     
    jazzylee77, Dec 2, 2005 IP
  16. AfterHim.com

    AfterHim.com Peon

    Messages:
    1,923
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Followed this quote above and still having trouble with a fully .html site...I have:

    <?php
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    include ('ad_network_460.php');
    echo $ad_network;
    ?>

    In my .html page

    I have the passthru.php page with that stuff in it. I have a the two ad network files, the .txt is writable.

    I added the .htaccess stuff.

    Did I miss something?
     
    AfterHim.com, Dec 4, 2005 IP
  17. jazzylee77

    jazzylee77 Peon

    Messages:
    578
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Smarty pants answer is... "Yes you missed something!" :)

    First question is by "I have the passthru.php page with that stuff in it." do you mean you have a file in your main directory named passthru.php with that data, except you have changed the 182 in the line include ('ad_network_182.php'); to the number of your ad network files? I'm assuming everything is going in your main directory.

    Also since you say you added it to your .htaccess, are there any pre-existing rules that may be causing a problem? If you suspect this you may try moving the new code to the top...I don't know why, but this works for me sometime.

    Also check the source file of one of your pages and see if there is eveidence of the ad-network code note being parsed. If thats the case try a test php file of some sort. If that works then there is something wrong in the codes you are using.

    Sorry those are my only guesses for now. Providing the url or more description may give others a clue.

    putting the echo adnetwork php in your html pages is superflous to the passthru.php technique. but if it is there then you should see it in the source code. and if it isn't working, check that number again comparing to your ad network files. then it becomes a why isn't my server parsing php in html pages for me question.
     
    jazzylee77, Dec 5, 2005 IP
  18. AfterHim.com

    AfterHim.com Peon

    Messages:
    1,923
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Jazzylee,

    I started a new post here: http://forums.digitalpoint.com/showthread.php?p=478538

    To answer your question, yes, i edited passthru.php and put it in my main dir.

    .htaccess was blank before.

    Check out the error on my thread posted above...I can get errors with the coop just not links :)

    Brandon
     
    AfterHim.com, Dec 5, 2005 IP