Skip to content

Instantly share code, notes, and snippets.

@carlosocarvalho
Last active April 20, 2017 04:56
Show Gist options
  • Save carlosocarvalho/671e8cf7cff5113fa3f6d250d262f8bc to your computer and use it in GitHub Desktop.
Save carlosocarvalho/671e8cf7cff5113fa3f6d250d262f8bc to your computer and use it in GitHub Desktop.
<?php
namespace App\Core;
use Philo\Blade\Blade;
class CoreController extends \CI_Controller{
/**
*@Blade
*/
protected $blade;
/**
*$data Array
*/
protected $data;
publicn function __construct(){
parent::__construct();
//initialize instance blade.
$this->blade = new Blade(VIEWPATH, APPPATH.'/cache/');
}
/**
* render view with Blade instance
*/
protected function view($view, $data = [], $return = false){
$this->data = array_merge($this->data, $data);
$blview = $this->blade->view()->make($view, $this->data)->render();
if(! $return )
return print( $blview );
return $blview;
}
}
//application/core/CoreController.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment