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
992f8edc
Commit
992f8edc
authored
Feb 21, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proper implementation of View::viewFile.
parent
97d291ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
View.php
framework/base/View.php
+15
-8
No files found.
framework/base/View.php
View file @
992f8edc
...
...
@@ -92,13 +92,12 @@ class View extends Component
* @internal
*/
public
$dynamicPlaceholders
=
[];
/**
* @var string the path of the view file currently being rendered. If the view is not
* in the process of rendering a view, this property is null.
* This property is mainly provided for information purpose and is maintained by [[renderFile()]].
* Do not modify it.
* @var array the view files currently being rendered. There may be multiple view files being
* rendered at a moment because one may render a view file within another.
*/
p
ublic
$viewFile
;
p
rivate
$_viewFiles
=
[]
;
/**
...
...
@@ -223,9 +222,9 @@ class View extends Component
if
(
$context
!==
null
)
{
$this
->
context
=
$context
;
}
$output
=
''
;
$this
->
viewFile
=
$viewFile
;
$this
->
_viewFiles
[]
=
$viewFile
;
if
(
$this
->
beforeRender
())
{
Yii
::
trace
(
"Rendering view file:
$viewFile
"
,
__METHOD__
);
$ext
=
pathinfo
(
$viewFile
,
PATHINFO_EXTENSION
);
...
...
@@ -241,14 +240,22 @@ class View extends Component
}
$this
->
afterRender
(
$output
);
}
$this
->
viewFile
=
null
;
array_pop
(
$this
->
_viewFiles
);
$this
->
context
=
$oldContext
;
return
$output
;
}
/**
* @return string|boolean the view file currently being rendered. False if no view file is being rendered.
*/
public
function
getViewFile
()
{
return
end
(
$this
->
_viewFiles
);
}
/**
* This method is invoked right before [[renderFile()]] renders a view file.
* The default implementation will trigger the [[EVENT_BEFORE_RENDER]] event.
* If you override this method, make sure you call the parent implementation first.
...
...
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