ob_start(); // call your function here $str = ob_get_contents(); ob_end_clean(); $vbulletin->templatecache['headinclude'] .= addcslashes($str, '\\"');