From 1b504be6508ac5c9580ffb713cf04bcd1e5dbec7 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 26 Nov 2013 08:52:21 -0500 Subject: [PATCH] Fixes #1323: Added View::defaultExtension. --- framework/yii/base/View.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/yii/base/View.php b/framework/yii/base/View.php index 3eee4ef..fcfe31e 100644 --- a/framework/yii/base/View.php +++ b/framework/yii/base/View.php @@ -65,6 +65,10 @@ class View extends Component */ public $renderers; /** + * @var string the default view file extension. This will be appended to view file names if they don't have file extensions. + */ + public $defaultExtension = '.php'; + /** * @var Theme|array the theme object or the configuration array for creating the theme object. * If not set, it means theming is not enabled. */ @@ -167,7 +171,7 @@ class View extends Component } } - return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . '.php' : $file; + return pathinfo($file, PATHINFO_EXTENSION) === '' ? $file . $this->defaultExtension : $file; } /**