Last active
November 12, 2019 02:07
-
-
Save darylteo/0fb8cc59dbcc62c90d1b81502408b7c4 to your computer and use it in GitHub Desktop.
Revisions
-
darylteo revised this gist
Nov 12, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,19 +26,25 @@ public function postDispatch(Zend_Controller_Request_Abstract $request) $obStartLevel = ob_get_level(); try { // hack to output header first $layout->setLayout('layout2018head'); $fullContent = $layout->render(); // set it back to original value for original behaviour. $layout->setLayout('layout2018'); } catch (Exception $e) { while (ob_get_level() > $obStartLevel) { $fullContent .= ob_get_clean(); } $request->setParam('layoutFullContent', $fullContent); $request->setParam('layoutContent', $layout->content); $response->setBody(null); throw $e; } ob_end_flush(); // output header immediately echo $fullContent; flush(); } -
darylteo revised this gist
Nov 12, 2019 . 1 changed file with 35 additions and 34 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,43 +1,44 @@ <?php public function postDispatch(Zend_Controller_Request_Abstract $request) { $layout = Zend_Layout::getMvcInstance(); // Return early if forward detected if (!$request->isDispatched() || $this->getResponse()->isRedirect() || ($layout->getMvcSuccessfulActionOnly() && (!empty($helper) && !$helper->isActionControllerSuccessful()))) { return; } // Return early if layout has been disabled if (!$layout->isEnabled()) { return; } if ($layout->getLayout() !== 'layout2018') { return; } $response = $this->getResponse(); $fullContent = null; $obStartLevel = ob_get_level(); try { $layout->setLayout('layout2018head'); $fullContent = $layout->render(); $layout->setLayout('layout2018'); } catch (Exception $e) { while (ob_get_level() > $obStartLevel) { $fullContent .= ob_get_clean(); } $response->setBody(null); throw $e; } ob_end_flush(); echo $fullContent; flush(); } -
darylteo created this gist
Nov 12, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ public function postDispatch(Zend_Controller_Request_Abstract $request) { $layout = Zend_Layout::getMvcInstance(); // Return early if forward detected if (!$request->isDispatched() || $this->getResponse()->isRedirect() || ($layout->getMvcSuccessfulActionOnly() && (!empty($helper) && !$helper->isActionControllerSuccessful()))) { return; } // Return early if layout has been disabled if (!$layout->isEnabled()) { return; } if ($layout->getLayout() !== 'layout2018') { return; } $response = $this->getResponse(); $fullContent = null; $obStartLevel = ob_get_level(); try { $layout->setLayout('layout2018head'); $fullContent = $layout->render(); $layout->setLayout('layout2018'); } catch (Exception $e) { while (ob_get_level() > $obStartLevel) { $fullContent .= ob_get_clean(); } $response->setBody(null); throw $e; } ob_end_flush(); echo $fullContent; flush(); }