ob_start(); include('path/to/file/cms.php'); $includedphp = ob_get_contents(); $myvar = display_footer(); ob_end_clean();