Created
April 13, 2012 21:33
-
-
Save jasonhazel/2380303 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function Module($filePath, $attributes) | |
{ | |
// Usage: Module('templateName.php', array('var1' => 'val1', 'var2' => 'val2', 'foo' => 'bar')) | |
//-- get Fusebox var in order to set also the circuit that has initiated the Module call | |
$a_Fusebox =& get_fusebox(); | |
$parentCircuit = $a_Fusebox['circuit']; | |
$isModule = true; | |
$myPath = getcwd() . '/'; | |
$aryPath = explode('/', $filePath); | |
$fileName = array_pop($aryPath); | |
$modPath = join('/', $aryPath); | |
chdir($myPath . $modPath); | |
require($fileName); | |
chdir($myPath); | |
//-- this is code added to allow a return array variable | |
if (isset($var_return_data)) | |
{ | |
return $var_return_data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment