Creates a new view based on the current theme
If the view cannot be found in the theme it's going to use the app::views

@param string		$file
@param array 		$data
@param bool		$encode
@return CCView
358165
public function view( $file = null, $data = null, $encode = false )
	{
		if ( \CCView::exists( $view = static::view_namespace().'::'.$file ) )
		{
			return \CCView::create( $view, $data, $encode );
		}
		
		return \CCView::create( $file, $data, $encode );
	}
218506
public function setTemplateFile($file)
    {
        $this->onRender[] = function() use ($file) {
            $this->getTemplate()->add('gridoTemplate', $this->getTemplate()->getFile());
            $this->getTemplate()->setFile($file);
        };

        return $this;
    }
1176355
protected function createView($key, $template = 'view.php')
    {
        try {
            // Prepare
            $path = $this->rootPath.'/assets/views';
            $views = explode('.', $key);
            // Loop creation
            for ($i = 0; $i < count($views); ++$i) {
                if (count($views) - 1 == $i) {
                    // File check
                    $filename = $path.'/'.$views[$i].'.php';
                    if (!file_exists($filename))
                        file_put_contents(
                            $filename,
                            preg_replace('/\{0\}/', $key, $this->getTemplate($template))
                        );
                } else {
                    // Directory check
                    $path .= '/'.$views[$i];
                    if (!is_dir($path))
                        mkdir($path);
                }
            }
            // Print end
            $this->_print('View created!');
            $this->_lineBreak();
        } catch (Exception $e) {
            file_put_contents(
                $this->rootPath.'/error_log',
                $e->getMessage()
            );
            throw new NoticeException('Command "'.$this->key.'": Fatal error ocurred.');
        }
    }
129712
public function render($file, $data = [])
    {
        $engine = $this->getEngine();

        $path = $this->findFile($file);

        $engine->setLoader($this->getLoader(dirname($path)));

        return $engine->render($file, $data);
    }
107537
public static function getView($viewName, $data = null, $templateRootFolder = null)
    {
        $view = new \erdiko\core\View($viewName, $data);

        if ($templateRootFolder !== null) {
            $view->setTemplateRootFolder($templateRootFolder);
        }
        return  $view->toHtml();
    }
157332
protected function view($data = null, $statusCode = null, array $headers = [])
    {
        return View::create($data, $statusCode, $headers);
    }
533470
public static function create(string $name, array $data = [])
    {
        $view = new static($name, $data);

        if (array_key_exists('url', $data)) {
            $view->setUrl($data['url']);
        }

        return $view;
    }
553323
public function view(string $name, array $data = [])
    {
        return $this->add(View::create($name, $data));
    }
842289
public function getView($filename, $data = null)
    {
        // $data = ($data === null) ? $this->_data : $data;
        return $this->getTemplateFile($this->getTemplateFolder().$filename, $data);
    }
73849
public function view(string $path, array $data = [], bool $return = false)
  {
    if ($this->headers !== ['Content-Type: application/json']) {
      foreach($this->headers as $header) {
        header($header);
      }
    }

    return View::make($path, $data, $return);
  }
824153
public function create($view, $data = [])
    {
        $filename = $this->getFinder()->find($view);

        $mergeMethod = ($data instanceof Data) ? 'addAll' : 'merge';

        $this->getData()->$mergeMethod($data);

        return new View($filename, $this->getData(), new Context($this));
    }
79118
public function view($view, array $data = [], $mergeData = [])
    {
        $data['template'] = $this;

        if ($view instanceof View) {
            return $view->with($data);
        }

        return view($this->getViewPath($view), $data, $mergeData);
    }
1180394
final protected function view(string $view, array $data = [])
    {       
        if ($data) extract($data);

        ob_start();
        require base_path().'/app/views/'.$view.'.php';
        $contentInLayout = ob_get_clean();

        require base_path().'/app/views/layouts/'.$this->layout.'.php';

        exit();
    }
613669
protected function render(array $data = [], $file = null) : Response
    {
        if ($file === null) {
            $file = $this->getTemplateFile();
        }

        // Relative path from the controller?
        if (substr($file, 0, 1) !== '/') {
            $file = $this->getTemplateFile($file);
        }

        $data += [
            'base_url' => 'http://' . $this->request->getHost(),
            '_messages' => $this->messages,
        ];
        $this->messages = [];

        return new Response($this->renderView($file, $data));
    }
1240369
public function load($file, $data = null)
    {
        $data = array_merge($this->data, (array) $data);

        $renderer = $this->createSelf();

        return $renderer->render($file, $data);
    }
901175
public function fromFile($file)
    {
        /** @var \DOMDocument $xmlDomDocument */
        if (!$xmlDomDocument = XmlUtils::loadFile($file, __DIR__ . '/../xsd/enums.xsd')) {
            throw new \RuntimeException(sprintf(
                'Invalid enums xml file "%s".',
                $file
            ));
        }

        /** @var array $xmlData */
        if (!$xmlData = XmlUtils::convertDomElementToArray($xmlDomDocument->firstChild)) {
            throw new \RuntimeException('Invalid enum DOM object.');
        }

        $namespace = $xmlData['enums']['namespace'];

        $filePath = substr($file, 0, -strlen(basename($file)) - 1);
        $enumsPath = str_replace(':', '/', $namespace);

        // invalid enum file location
        if (substr($filePath, -strlen($enumsPath)) !== $enumsPath) {
            throw new \RuntimeException(sprintf(
                'Invalid enums xml directory "%s". Expected sub-directory "%s".',
                $filePath,
                $enumsPath
            ));
        }

        // get language options
        $languages = [];
        foreach ($xmlData['enums'] as $key => $value) {
            if (substr($key, -8) == '-options') {
                $languages[$key] = $value;
            }
        }

        $enums = [];

        if (isset($xmlData['enums']['enum'])) {
            $xmlData['enums']['enum'] = $this->fixArray($xmlData['enums']['enum'], 'name');

            foreach ($xmlData['enums']['enum'] as $enum) {
                $enumId = EnumId::fromString(sprintf('%s:%s', $namespace, $enum['name']));

                // duplicate schema
                if (array_key_exists($enumId->toString(), $enums)) {
                    throw new \RuntimeException(sprintf(
                        'Duplicate enum "%s" in file "%s".',
                        $enumId->toString(),
                        $file
                    ));
                }

                $enums[] = $this->parse(array_merge($enum, $languages, ['namespace' => $namespace]));
            }
        }

        return $enums;
    }
524665
public static function partial($file, $data = [])
    {
        $path = self::load('views.partials.' . $file);

        extract($data, EXTR_SKIP);

        include $path;
    }