This is how I got this to work:
ob_start();
extract($passedData, EXTR_SKIP);
include($fileToInclude);
if(isset($_return)){
$this->result = $_return;
} else {
$this->result = ob_get_contents();
}
ob_end_clean();
Now if the template file has a variable named $_return defined it will be returned instead of the normal ob contents.
If there is a better way of doing this please let me know.