From 4fb343202838985ddf32ca7bc70e7467842b61bc Mon Sep 17 00:00:00 2001 From: maximebf Date: Tue, 24 Sep 2013 09:53:49 -0400 Subject: [PATCH] fixed bug with file extensions in uri (fixed #20) --- example/app/config.php | 6 +++++- src/Atomik.php | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/example/app/config.php b/example/app/config.php index a41f90d..50df327 100644 --- a/example/app/config.php +++ b/example/app/config.php @@ -7,9 +7,13 @@ 'dsn' => 'sqlite:example.db' ), 'Session', - 'Flash' + 'Flash', + 'Errors' => array( + 'catch_errors' => true + ) ), + 'atomik.debug' => true, 'app.layout' => '_layout' )); diff --git a/src/Atomik.php b/src/Atomik.php index 9b8b3cc..f19cc6c 100644 --- a/src/Atomik.php +++ b/src/Atomik.php @@ -572,10 +572,14 @@ public static function route($uri, $params = array(), $routes = null) } if (!$found) { + $format = self::get('app.views.default_context', 'html'); + if ($uriExtension !== false) { + $uri = substr($uri, 0, -strlen($uriExtension) - 1); + $format = $uriExtension; + } $request = array( 'action' => $uri, - self::get('app.views.context_param', 'format') => $uriExtension === false ? - self::get('app.views.default_context', 'html') : $uriExtension + self::get('app.views.context_param', 'format') => $format ); }