best way to run a php script away from the template?

Hi @Mild Fuzz:

Sounds like what you might be looking for is the template_redirect hook. If you add a function for that hook then you can output whatever you want and end with an exit; statement.

add_action( 'template_redirect', 'yoursite_template_redirect' );
function yoursite_template_redirect() {
  if (isset($_GET['foo']) && $_GET['foo']=='bar') {
    // Do whatever you want when $_GET['foo']=='bar'
  }
}

You’ll need to figure out what criteria to test for such as I showed with $_GET['foo']=='bar', but is that what you are looking for?