Co-op on .shtml files

Discussion in 'Co-op Advertising Network' started by onlinedude, Sep 14, 2005.

  1. #1
    I'm trying to set up the co-op on a site which uses .shtml files and having difficulties.

    Some of the files are .php files, and the co-op is working fine on these, so it's not a problem with the php.

    I'm using an include in the form suggested in the FAQs:
    <!--#include virtual="/ad_network_379.php" -->

    However, the include just doesn't seem to execute. Other includes on the web site work fine.

    I've tried adding the following to my .htaccess file:
    AddType application/x-httpd-php .shtml

    But that didn't help either.

    In case it makes a difference, my host says this about php:
    PHP is run as a CGI binary. You may be familiar with PHP as an Apache module. We do not run PHP as an Apache module on our shared servers.

    Anyone have an idea what might be wrong or what I can test?

    Thanks in advance for your help.
     
    onlinedude, Sep 14, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    What's one of the URLs where you are trying to use an shtml include?
     
    digitalpoint, Sep 14, 2005 IP
  3. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #3
    PM sent to you.
     
    onlinedude, Sep 14, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Try adding a
    echo 'test output';
    PHP:
    to the end of your ad_network PHP file. When you do that, do you see it on the .shtml pages by chance?
     
    digitalpoint, Sep 14, 2005 IP
  5. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, the words "test output" show up on the page.
     
    onlinedude, Sep 14, 2005 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    Okay, that's a good thing... means the include is working (if it wasn't, I wouldn't know what to tell you).

    Okay, instead of the echo line I just gave you, let's put this instead:

    echo 'DN = ' . $_SERVER['DOCUMENT_NAME'];
    PHP:
    That should spit out the document name (the .shtml document), does it? And if not, what is it giving you?
     
    digitalpoint, Sep 14, 2005 IP
  7. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #7
    All it spits out is: DN =
     
    onlinedude, Sep 14, 2005 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    What about when you view it from a PHP file? Same thing?
     
    digitalpoint, Sep 14, 2005 IP
  9. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #9
    From a php file, I get: DN= [then the co-op links]
     
    onlinedude, Sep 14, 2005 IP
  10. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #10
    Okay... go ahead and take out that echo line from your ad_network PHP file.

    In your ad_network PHP file, change
    if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') {
    PHP:
    to
    if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml' || true) {
    PHP:
    On your PHP file(s) that you have the include() on, remove the following line:
    echo $ad_network;
    PHP:
    What that will do is forget about trying to detect a .shtml file (since your server isn't telling the file name) and just output the $ad_network variable within the include.
     
    digitalpoint, Sep 14, 2005 IP
  11. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #11
    OK, we're making some progress - thanks! It's interesting to learn all of this.

    This seems to have solved the issue with the .shtml files.

    With the .php files, the co-op links are still appearing, but I also get an error message:

    Warning: ini_set(): Cannot change zlib.output_compression - headers already sent in /home/www/my-site/ad_network_361.php on line 100

    Would it make sense if I simply had 2 separate co-op files - one to be called by the .shtml files with the modification you suggested, and a separate one to be called by the .php files?
     
    onlinedude, Sep 14, 2005 IP
  12. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #12
    No, just remove the zlib.output_compression line. You will know if there is a problem by doing that right away, because if there is, the ads will look like random garbage on your .shtml pages (hopefully it's fine).
     
    digitalpoint, Sep 14, 2005 IP
    onlinedude likes this.
  13. onlinedude

    onlinedude Peon

    Messages:
    1,193
    Likes Received:
    322
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Cool! Everything seems to be working. Thanks so much!!
     
    onlinedude, Sep 14, 2005 IP