Example #1
0
    public static function render($vars, $displayContents = true)
    {
			// Get Templating Vars
			extract($vars, EXTR_SKIP);

      // Include Helper Functions
      require(BASEPATH.'/app/helpers/template.php');

			// Render View File
			ob_start();
			include(BASEPATH.'/app/views/'.Routes::getController().'/'.Routes::getMethod().'.php');
			$contents = ob_get_contents();
			ob_end_clean();

			// Render Layout File
			ob_start();
			include(BASEPATH.'/app/views/layouts/'.Routes::getController().'.php');
			$view = ob_get_contents();
			ob_end_clean();

      foreach($templates as $key => $value)
        $view = str_ireplace($key, $value, $view);
  
      // Render View
      if ($displayContents)
        print $view;
      return $view;
		}
Example #2
0
		public function render()
		{
			// Get Template and Page
			if (!file_exists(BASEPATH.'/app/views/'.Routes::getController().'/'.Routes::getMethod().'.php'))
				trigger_error('View file "'.Routes::getController().'/'.Routes::getMethod().'.php" was not found.');
      Template::render($this->vars, true);
		}