Added dot notation magic for URIs

Used to be very rigid in that each URI had to map to a single module. Now the inclusion of dots in the URI allow you to have multiple end points in a single file. /user/edit and /user/edit.save both resolve to /modules/user/edit.php
This commit is contained in:
Josh Sherman 2012-11-30 17:33:53 -05:00
parent 29c0dbad1f
commit f75862fabd
2 changed files with 28 additions and 0 deletions

View file

@ -452,6 +452,12 @@ class Controller extends Object
*/
public function prepareVariables($basename)
{
if (strpos($basename, '.') !== false)
{
list($basename, $action) = explode('.', $basename, 2);
$action = str_replace('.', '_', $action);
}
// Sets up all of our variables
$module_class = strtr($basename, '/', '_');
$module_filename = SITE_MODULE_PATH . $basename . '.php';
@ -459,6 +465,14 @@ class Controller extends Object
$css_class = $module_class;
$js_basename = $basename;
if (isset($action))
{
$module_class .= '_' . $action;
$template_basename .= '/' . $action;
$css_class .= '_' . $action;
$js_basename .= '/' . $action;
}
// Scrubs class names with hyphens
if (strpos($module_class, '-') !== false)
{