Pages on a website I am redesigning for a client use some php scripting to generate. However, for some reason, the page I have for bad_template does not seem to allow the php scripts in the page code to run.

I have set TEMPLATEDIR=""
I have set TEMPLATEURL=$SCHEME.$SERVER."/_formmail/form_templates/"
All the pages involved have .php as their extension.

I have tried TEMPLATEURL with no trailing slash and also using "http://www.sitename.com/_formmail/form_templates" to no avail.
Although the site doesn't use sessions, I have tried giving formmail its own unique session name (and done it in verifyimg.php, formmail.php, and fmbadhandler.php).

The strange thing is that some php on the page executes. For example, there is an email link in the corner that a simple line of php base64_decode. However, the page calls an external php script at the end -- that is what is not running. At one point, I had it calling an external php script in another spot that was not running (it was going to the php script but ignoring all php and just inserting html and javascript from the php script into the webpage where it should be deciding between the html or the javascript depending on the user's settings for javascript, as it does on other pages with no problem). The php is not in the source for my bad_template, so it is being dealt with at some level.

I can't seem to figure out what is stopping the external php scripts from running. This is the php that is not running:

at the beginning of the page:

<?php ob_start(); ?>

at the end of the page:

<?php
include_once ( $_SERVER['DOCUMENT_ROOT'].'/replacePngTags.php' );
echo replacePngTags(ob_get_clean());
?>

If you go to the page directly through the browser, it displays fine, so the php is good, it's just not being processed when it goes through fmbadhandler.

Thanks in advance for the help.