Skip to content

Instantly share code, notes, and snippets.

@gn0st1k4m
gn0st1k4m / gist:de466bf33af08e447fed
Created March 4, 2016 02:40 — forked from raplos/gist:6560810
ajax-answer for ajax-request in phalcon base controller
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(),
@gn0st1k4m
gn0st1k4m / CliTest.php
Created October 11, 2015 19:52 — forked from racklin/CliTest.php
Phalcon CLI descriptions (invo web)
<?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. |