Created
November 5, 2013 15:42
-
-
Save Cacodaimon/7321018 to your computer and use it in GitHub Desktop.
Tiny slim json view.
This file contains 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
class SlimJsonView extends \Slim\View | |
{ | |
public function render($template = null) | |
{ | |
$app = \Slim\Slim::getInstance(); | |
!$this->has('error') && $this->data->remove('flash'); | |
!$this->has('flash') && $this->data->remove('flash'); | |
$app->response()->header('Content-Type', 'application/json'); | |
$app->response()->body(json_encode($this->all())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment