I am running an .html site. .htaccess has been modified to server parse .html and .inc files. SSI does work on the pages. <!--#echo var="DATE_LOCAL" --> Code (markup): does work on the page. I do not believe I have mod rewrite enabled as I tried the method in another thread of using mod rewrite and passthru.php. The test page I am using is http://www.1stop-satellite-radio.com/xmradio.html I will get the code working here and then put it on all pages. Any ideas as what to try?
If that SSI function works, but not the virtual include, then it's mostly likely a configuration issue with the server itself.
The odd thing is that where the include for ad_network file shows the php code, but only part of the code. The code that shows on the page is below. ', $ads); if (count ($ads) < 401 || $ads[0] + 900 < time()) { $new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?s=' . $_SERVER['SERVER_NAME'] . '&type=link'); $ads[] = $new_ad; $ads[0] = time(); if (count ($ads) > 401) unset ($ads[1]); if ($new_ad) { $file = fopen($ad_file, 'w'); fwrite ($file, implode ('', $ads)); fclose ($file); } $ad = end ($ads); } else { $ad = $ads[rand(1,count($ads) - 1)]; } $ad_network[] = $ad; while (count ($ad_network) < 5) { $ad_network[] = $ads[rand(1,count($ads) - 1)]; } } else { $ad_network[] = 'You must set the "ad_network_ads.txt" file to be writable.'; } if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') { ini_set ('zlib.output_compression', 0); echo end ($ad_network); } ?> Code (markup): Why would only part of the code from that php file show? And why is it showing at all?
I'm including another php file right above the ad network.php file. The other php include is working fine.
Yup. Here it is: <?php if (!function_exists('file_get_contents')) { function file_get_contents($url) { $handle = fopen($url, 'r'); $string = fread($handle, 4096000); fclose($handle); return $string; } } if (!function_exists('make_seed')) { function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } srand (make_seed()); } if (!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS; $ad_file = 'ad_network_ads.txt'; for ($i = 0; $i <= 11; $i++) { $p = substr ('../../../../../../../../../../', 0, $i * 3); if (file_exists ($p . $ad_file)) { $ad_file = $p . $ad_file; break; } } if (is_writable ($ad_file)) { $ads = file_get_contents ($ad_file); $ads = explode ('<ad_break>', $ads); if (count ($ads) < 401 || $ads[0] + 900 < time()) { $new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?s=' . $_SERVER['SERVER_NAME'] . '&type=link'); $ads[] = $new_ad; $ads[0] = time(); if (count ($ads) > 401) unset ($ads[1]); if ($new_ad) { $file = fopen($ad_file, 'w'); fwrite ($file, implode ('<ad_break>', $ads)); fclose ($file); } $ad = end ($ads); } else { $ad = $ads[rand(1,count($ads) - 1)]; } $ad_network[] = $ad; while (count ($ad_network) < 5) { $ad_network[] = $ads[rand(1,count($ads) - 1)]; } } else { $ad_network[] = 'You must set the "ad_network_ads.txt" file to be writable.'; } if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml') { ini_set ('zlib.output_compression', 0); echo end ($ad_network); } ?> Code (markup):
If you access the ad_network.php file directory, do you get an error? (It should be a blank window with nothing in the source)
Doesn't work. The browser tries to save it to a disk or find an application to open it. Here's my .htaccess Options +Includes AddType text/html .html .inc AddHandler server-parsed .html .inc .php options -Indexes Code (markup): And here's the location www.1stop-satellite-radio.com/ad_network.php
Ok we're moving along! Now I get this error: Fatal error: [] operator not supported for strings in /ad_network.php on line 35 The code for that line is $ads[ ] = $new_ad; Code (markup):
Php isn't the problem though it was choking on that line. I had to delete the lines around it and retype it back in and now no error message but no ads, it's just blank. There seems to be an ad sitting in the ad network text file though but it's not showing up.
I read another thread discussing ads not showing and put this echo $ad_network[0]; Code (markup): at the bottom of the ad network php and guess what. It works!