theme creator
returns a new view instance

@param string		$file
@param array 		$data
@param bool		$encode
@return CCView
179390
public static function create( $file = null, $data = null, $encode = false ) 
	{
		$view = parent::create( static::view_namespace().'::'.$file, $data, $encode );
		
		// set the asset holder path
		\CCAsset::holder( 'theme' )->path = static::public_namespace();
		
		// set the vendor path
		\CCAsset::holder( 'vendor' )->path = 'assets/vendor/';
		
		// you may ask why not just return the parent::create(bla bla.. directly?
		// i actually wanted to do something with that var view. So if you'r still
		// able to read this i completly forgot it.
		return $view;
	}
1240369
public function load($file, $data = null)
    {
        $data = array_merge($this->data, (array) $data);

        $renderer = $this->createSelf();

        return $renderer->render($file, $data);
    }
162999
protected function getViewFile($view,$code)
	{
		$viewPaths=array(
			Yii::app()->getTheme()===null ? null :  Yii::app()->getTheme()->getSystemViewPath(),
			Yii::app() instanceof CWebApplication ? Yii::app()->getSystemViewPath() : null,
			YII_PATH.DIRECTORY_SEPARATOR.'views',
		);

		foreach($viewPaths as $i=>$viewPath)
		{
			if($viewPath!==null)
			{
				 $viewFile=$this->getViewFileInternal($viewPath,$view,$code,$i===2?'en_us':null);
				 if(is_file($viewFile))
				 	 return $viewFile;
			}
		}
	}
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));
    }
271910
public function render($file, array $data = array(), callable $callback = null) {
        $content = $this->setAttribute($data)
            ->getView($file)->render($callback);
        $layout = $this->findLayoutFile();
        if (empty($layout)) {
            return $content;
        }
        return $this->getView($layout)
            ->renderWithData(['content' => $content]);
    }
397617
public function render($file, $data = [])
    {
        $path = $this->findFile($file);

        $this->config->set('path.found', $path);

        return $this->getEngine()->render($file, $data);
    }
43804
protected function json($data, bool $encode = true) : Response
    {
        if ($encode) {
            $data = json_encode($data);
        }

        return $this->createResponse($data, 'application/json');
    }
542628
public static function view($file, array $args = [], bool $minify = false, array $headers = [], $code = 200)
    {
        $headers['Content-Type'] = 'text/html';
        if ($minify === true) {
            $minify = new Minify();
            self::renderTemplate($file, $args);
            $config = [
                'code'    => $code,
                'body'    => $minify->htmlMinify(ob_get_clean(), 'code'),
                'headers' => [
                    $headers,
                ],
            ];
            $response = new Response($config);
            $response->send();
        } else {
            self::renderTemplate($file, $args);
            $config = [
                'code'    => $code,
                'body'    => ob_get_clean(),
                'headers' => [
                    $headers,
                ],
            ];
            $response = new Response($config);
            $response->send();
        }
    }
117620
public static function find(String $file, String $data) : stdClass
    {
        $contents = self::read($file);
        $index    = strpos($contents, $data);

        return (object)
        [
            'index'    => $index,
            'contents' => $contents
        ];
    }
441724
public function create($path, $data = array())
    {
        $path = $this->buildPath($path);

        if(!file_exists($path))
            throw new NotFoundException('Unable to find view ['.$path.']');

        // merge with default data.
        $class = '\Exedra\View\View';

        if(is_string($data))
        {
            // assume data as fully qualified class name
            if($data)
            {
                $class = $data;

                $data = array();
            }
        }
        else
        {
            if(!is_array($data))
                throw new NotFoundException('Argument 2 must be either string or array ['.gettype($data).'] given.');
        }

        $data = array_merge($data, $this->defaultData);

        return new $class($path, $data);
    }
236529
public function writeToThemeFile($file, $data)
    {
        $this->writeToFile(
            $this->config['themes'] . Utils::unleadslashit($file),
            $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);
  }
1309339
public final function view(string $file, array $content = null, bool $useViewPartials = null): void
    {
        if (!$this->useView) {
            throw new ServiceException("Set \$useView = true in service and be sure that already ".
                "included 'froq/froq-view' module via Composer");
        }

        $data = (array) ($content['data'] ?? []);
        $meta = (array) ($content['meta'] ?? []);

        // set meta if provided
        if ($meta != null) {
            foreach ($meta as $name => $value) {
                $this->view->setMeta($name, $value);
            }
        }

        $this->view->setFile($file);

        // override on runtime calls
        $useViewPartials = $useViewPartials ?? $this->useViewPartials;

        // set header/footer partials if uses
        if ($useViewPartials) {
            $this->view->setFileHead();
            $this->view->setFileFoot();
        }

        $this->view->display($data);
    }
699815
public static function newDocumentFile($file, $contentType = null) 
    {
        $documentID = self::createDocumentWrapper(
            file_get_contents($file), $contentType
        );
        return new phpQueryObject($documentID);
    }
1174235
public function render($file, $data = array(), $merge = true, $default = '')
    {
        settype($data, 'array');
        $templates = $this->getTemplateFiles($file);

        if ($merge) {
            $data = array_merge($data, $this->getDefaultData());
        }

        $rendered = null;
        $this->hook->attach('template.render', $templates, $data, $rendered, $this);

        if (isset($rendered)) {
            return trim($rendered);
        }

        list($original, $overridden) = $templates;

        if (is_file("$overridden.php")) {
            $template = "$overridden.php";
        } else if (is_file("$original.php")) {
            $template = "$original.php";
        } else {
            return $default;
        }

        $rendered = $this->renderPhpTemplate($template, $data);
        return trim($rendered);
    }
129712
public function render($file, $data = [])
    {
        $engine = $this->getEngine();

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

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

        return $engine->render($file, $data);
    }
1216246
public function img($file, $ext=null, $theme=null) {
        
        $this->secondaryTheme($theme);
        
        $img = $this->enqueueFiles($file, $this->container->getIMG(), $ext);
        
        return $img;
        
    }