Skip to content

Instantly share code, notes, and snippets.

@jasonhazel
Created April 13, 2012 21:33
Show Gist options
  • Save jasonhazel/2380303 to your computer and use it in GitHub Desktop.
Save jasonhazel/2380303 to your computer and use it in GitHub Desktop.
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