Skip to content

Instantly share code, notes, and snippets.

@timjb
Created April 6, 2010 12:50
Show Gist options
  • Save timjb/357555 to your computer and use it in GitHub Desktop.
Save timjb/357555 to your computer and use it in GitHub Desktop.
<?php
# Snippet to include files from filesystem
# [[includeFile? &file=`assets/templates/mytemplate/file.html`]]
if ( !isset($file) || $file== "" ) return "No file specified."; //check if there's a file given.
//Start the buffer
ob_start();
//include
include $file;
//get contents from the buffer
$ob_contents = ob_get_contents();
//and kill/delete the buffer
ob_end_clean();
//return it to MODx
return $ob_contents;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment