Permalink
Browse files

Remove redundant .php from template paths

Provides support for writing shorter template paths with 'controller/action.format'  only, without having to add the ".php" extension to the path.

The file is always going to be .php anyway, so why write it each time?

Backwards compatible to handle paths with .php extension as well.
  • Loading branch information...
kematzy committed Jan 4, 2012
1 parent 5a73e94 commit 858319b638175888a73bcc5be43d363587b1577d
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/limonade.php
View
@@ -1761,7 +1761,8 @@ function render($content_or_func, $layout = '', $locals = array())
$args = func_get_args();
$content_or_func = array_shift($args);
$layout = count($args) > 0 ? array_shift($args) : layout();
- $view_path = file_path(option('dir.views'),$content_or_func);
+ $ext = ( substr($content_or_func, -4) === '.php' ) ? '' : '.php';
+ $view_path = file_path(option('dir.views'),$content_or_func . $ext);
if(function_exists('before_render'))
{

0 comments on commit 858319b

Please sign in to comment.