Created
April 6, 2010 12:50
-
-
Save timjb/357555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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