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.

Ads not working on on sub-directory - using mod_rewrite

Discussion in 'Co-op Advertising Network' started by Patient, Oct 20, 2004.

  1. #1
    This is my first post. Joined the ad network about two weeks ago and it works really well. Thanks to Shawn for his brilliance and generosity.

    I hope someone can help me modify the script so that I can use it anywhere on my sites whatever pages I place them on (at present it doesn't work on certain pages).
    SEMrush
    I have tried the following in the page:

    $adnet = $dir.'ad_network.php?dir='.$dir;
    include ($adnet);

    Where $dir is the website domain (http://www.mysite.com/) and this works in that it calls ad_network.php OK.

    I have tried the following in ad_network.php:

    $ad_file = $dir.'ad_network_ads.txt';

    and this delivers the correct address ie http://www.mysite.com/ad_network_ads.tx

    However, the script fails to open this file.

    Any ideas please?

    Thanks in advance.
     
    Patient, Oct 20, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,287
    Likes Received:
    2,602
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    What error does it give when it fails?
     
    digitalpoint, Oct 20, 2004 IP
  3. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #3
    I have it working now by calling include('../ad_network.php') so that it looks one level up to find the file in the root directory.

    It would be nice though if I could make it bulletproof so that I can use the same code everywhere. I was not getting errors it was just saying that the ad_network_ads.txt was not writeable - I believe this was a result of simply not finding the file rather than it not being writable as the file is definitely writable and works for all other pages.

    My specific circumstances on this site are that all but 4 pages are at root level with these 4 pages being index pages in sub-directories. However, all page addresses are rewritten using mod_rewrite which presumably is where the problem lies.

    PS Thanks for updating my weightings - I really don't like to bother you with pm's so if I knew the automatic update schedule I have the patience to wait for it! After surfing this forum I have the impression that its about every three days and if that is the case I am content to wait for it. My apologies as I should have searched harder to find the update schedule before.
     
    Patient, Oct 20, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,287
    Likes Received:
    2,602
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    If you know the full path to the ad_network.php and ad_network_ads.txt file, you can use those and it will always work.
     
    digitalpoint, Oct 20, 2004 IP
  5. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #5
    This:

    $ad_file = $dir.'ad_network_ads.txt';

    creates the fill path http://www.mysite.com/ad_network_ads.txt
    and when I echo the variable its spot on but.... it says the file is not writable which I interpret as it didn't find the file.

    Anyway the ads are working now so no need to spend more time on at present.

    Thanks
     
    Patient, Oct 20, 2004 IP