Skip to content

Instantly share code, notes, and snippets.

@paulund
Created August 5, 2013 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulund/6155875 to your computer and use it in GitHub Desktop.
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.
<?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