Created
August 5, 2013 13:22
-
-
Save paulund/6155875 to your computer and use it in GitHub Desktop.
Assign variables that can be used inside a view and store the view with populated variable.
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 | |
/** | |
* Get the view file | |
* | |
* @param [type] $view [description] | |
* @param [type] $vars [description] | |
* @return [type] [description] | |
*/ | |
public function getView($viewFile, $vars) | |
{ | |
extract($vars); | |
ob_start(); | |
include_once $viewFile; | |
$view = ob_get_contents(); | |
ob_end_clean(); | |
return $view; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment