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 characters
public function afterExecuteRoute($dispatcher) { | |
$is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; | |
if ($is_ajax) { | |
$this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); | |
$eventsManager = new \Phalcon\Events\Manager(); | |
$eventsManager->attach('view:afterRender', function ($event, $view) { | |
$view->setContent(json_encode(array( | |
'content' => $view->getContent(), |
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 characters
<?php | |
/* | |
+------------------------------------------------------------------------+ | |
| Phalcon Framework | | |
+------------------------------------------------------------------------+ | |
| Copyright (c) 2011-2012 Phalcon Team (http://www.phalconphp.com) | | |
+------------------------------------------------------------------------+ | |
| This source file is subject to the New BSD License that is bundled | | |
| with this package in the file docs/LICENSE.txt. | |