예제 #1
0
 /**
  * Grabs the current RenderableInterface-compatible class
  * and tells it to render the specified view. Simply provides
  * a convenience method that can be used in Controllers,
  * libraries, and routed closures.
  *
  * NOTE: Does not provide any escaping of the data, so that must
  * all be handled manually by the developer.
  *
  * @param string $name
  * @param array  $data
  * @param array  $options Unused - reserved for third-party extensions.
  *
  * @return string
  */
 function view(string $name, array $data = [], array $options = [])
 {
     /**
      * @var CodeIgniter\View\View $renderer
      */
     $renderer = Services::renderer();
     $saveData = false;
     if (array_key_exists('saveData', $options) && $options['saveData'] === true) {
         $saveData = (bool) $options['saveData'];
         unset($options['saveData']);
     }
     return $renderer->setData($data, 'raw')->render($name, $options, $saveData);
 }
예제 #2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->viewer = Services::renderer(null, true);
 }