
// &file=`assets/foo/bar.php` indicates the file to include
// &return=`1` return explicit content from return statement in included file
//  default behavior is to use output buffering to capture the content from the include

$output = '';
if (isset($file) && file_exists($modx->config['base_path'] . $file)) {
    if (!isset($return) || $return == false) {
        ob_start();
        include ($modx->config['base_path'] . $file);
        $output = ob_get_contents();
        ob_end_clean();
    } else {
        $output = include ($modx->config['base_path'] . $file);
    }
} else {
   $path_parts = pathinfo($file);
   return sprintf('The file: %s was not found', $path_parts['basename']);
}
return $output;
