Skip to content

Instantly share code, notes, and snippets.

@linxlad
Forked from rianorie/gist:7f9bf5c92d2559cf2bff
Last active August 29, 2015 14:08
Show Gist options
  • Save linxlad/752b2a7b3690d0b427e2 to your computer and use it in GitHub Desktop.
Save linxlad/752b2a7b3690d0b427e2 to your computer and use it in GitHub Desktop.
<?php // file [project]/Library/View.php
namespace YourNamespace\Library;
class extendedView extends \Phalcon\Mvc\View
{
public function getPartial($path, $params = array())
{
ob_start();
$this->partial($path, $params);
return ob_get_clean();
}
}
<?php // in your DI
$config = $this->config;
$this->di->set('view', function() use ($config) {
$view = new \YourNamespace\Library\extendedView();
$view->setViewsDir(__DIR__ . $config->application->viewsDir);
return $view;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment