Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
a1f7f8bc
Commit
a1f7f8bc
authored
Nov 28, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1335: support view extension fallback
parent
9d57b40b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
Controller.php
framework/yii/base/Controller.php
+7
-3
View.php
framework/yii/base/View.php
+9
-2
No files found.
framework/yii/base/Controller.php
View file @
a1f7f8bc
...
...
@@ -417,9 +417,13 @@ class Controller extends Component implements ViewContextInterface
$file
=
$module
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$layout
;
}
if
(
pathinfo
(
$file
,
PATHINFO_EXTENSION
)
=
==
''
)
{
$file
.=
$view
->
defaultExtension
;
if
(
pathinfo
(
$file
,
PATHINFO_EXTENSION
)
!
==
''
)
{
return
$file
;
}
return
$file
;
$path
=
$file
.
'.'
.
$view
->
defaultExtension
;
if
(
$view
->
defaultExtension
!==
'php'
&&
!
is_file
(
$path
))
{
$path
=
$file
.
'.php'
;
}
return
$path
;
}
}
framework/yii/base/View.php
View file @
a1f7f8bc
...
...
@@ -67,7 +67,7 @@ class View extends Component
/**
* @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'
;
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.
...
...
@@ -171,7 +171,14 @@ class View extends Component
}
}
return
pathinfo
(
$file
,
PATHINFO_EXTENSION
)
===
''
?
$file
.
$this
->
defaultExtension
:
$file
;
if
(
pathinfo
(
$file
,
PATHINFO_EXTENSION
)
!==
''
)
{
return
$file
;
}
$path
=
$file
.
'.'
.
$this
->
defaultExtension
;
if
(
$this
->
defaultExtension
!==
'php'
&&
!
is_file
(
$path
))
{
$path
=
$file
.
'.php'
;
}
return
$path
;
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment