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
13b7c8e8
Commit
13b7c8e8
authored
Feb 05, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored Pjax. Added title change support. [skip ci]
parent
a872d605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
Pjax.php
framework/widgets/Pjax.php
+25
-24
No files found.
framework/widgets/Pjax.php
View file @
13b7c8e8
...
...
@@ -89,15 +89,17 @@ class Pjax extends Widget
$this
->
options
[
'id'
]
=
$this
->
getId
();
}
ob_start
();
ob_implicit_flush
(
false
);
if
(
$this
->
requiresPjax
())
{
ob_start
();
ob_implicit_flush
(
false
);
$view
=
$this
->
getView
();
$view
->
clear
();
$view
->
beginPage
();
$view
->
head
();
$view
->
beginBody
();
if
(
$view
->
title
!==
null
)
{
echo
Html
::
tag
(
'title'
,
Html
::
encode
(
$view
->
title
));
}
}
echo
Html
::
beginTag
(
'div'
,
$this
->
options
);
}
...
...
@@ -108,32 +110,31 @@ class Pjax extends Widget
public
function
run
()
{
echo
Html
::
endTag
(
'div'
);
if
(
$requiresPjax
=
$this
->
requiresPjax
())
{
$view
=
$this
->
getView
();
$
view
->
endBody
();
$view
->
endPage
(
true
)
;
if
(
!
$this
->
requiresPjax
())
{
$
this
->
registerClientScript
();
return
;
}
$view
=
$this
->
getView
();
$view
->
endBody
();
$view
->
endPage
(
true
);
$content
=
ob_get_clean
();
if
(
$requiresPjax
)
{
// only need the content enclosed within this widget
$response
=
Yii
::
$app
->
getResponse
();
$level
=
ob_get_level
();
$response
->
clearOutputBuffers
();
$response
->
setStatusCode
(
200
);
$response
->
format
=
Response
::
FORMAT_HTML
;
$response
->
content
=
$content
;
$response
->
send
();
// only need the content enclosed within this widget
$response
=
Yii
::
$app
->
getResponse
();
$level
=
ob_get_level
();
$response
->
clearOutputBuffers
();
$response
->
setStatusCode
(
200
);
$response
->
format
=
Response
::
FORMAT_HTML
;
$response
->
content
=
$content
;
$response
->
send
();
// re-enable output buffer to capture content after this widget
for
(;
$level
>
0
;
--
$level
)
{
ob_start
();
ob_implicit_flush
(
false
);
}
}
else
{
$this
->
registerClientScript
();
echo
$content
;
// re-enable output buffer to capture content after this widget
for
(;
$level
>
0
;
--
$level
)
{
ob_start
();
ob_implicit_flush
(
false
);
}
}
...
...
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