Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Created October 3, 2012 15:49
Show Gist options
  • Save joshtronic/3827705 to your computer and use it in GitHub Desktop.
Save joshtronic/3827705 to your computer and use it in GitHub Desktop.
<?php
/**
* Prepare Variables
*
* Processes the request variable and creates all the variables that the
* Controller needs to load the page.
*
* @param string $basename the requested page
* @return array the resulting variables
*/
public function prepareVariables($basename)
{
// Sets up all of our variables
$module_class = strtr($basename, '/', '_');
$module_filename = SITE_MODULE_PATH . $basename . '.php';
$template_basename = $basename;
$css_class = $module_class;
$js_basename = $basename;
// Scrubs class names with hyphens
if (strpos($module_class, '-') !== false)
{
$module_class = preg_replace('/(-(.{1}))/e', 'strtoupper("$2")', $module_class);
}
return array($module_class, $module_filename, $template_basename, $css_class, $js_basename);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment