Last active
April 20, 2017 04:56
-
-
Save carlosocarvalho/671e8cf7cff5113fa3f6d250d262f8bc to your computer and use it in GitHub Desktop.
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 | |
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