예제 #1
0
 protected function parseFile($file)
 {
     $tokens = token_get_all(file_get_contents($file));
     //  var_dump($tokens);die();
     $count = count($tokens) - 1;
     for ($i = 0; $i < $count; $i++) {
         $token = $tokens[$i];
         if ($token[0] == 307) {
             $method = $token[1];
             if ($method === 'getCss') {
                 $type = 'css';
             } elseif ($method === 'getJs') {
                 $type = 'js';
             } else {
                 $type = null;
             }
             if ($type !== null) {
                 $arg = $this->getArgument($tokens, $i);
                 $sourcePath = AssetResolver::resolveSourcePath($arg, \eBuildy\Helper\ResolverHelper::getModulePathFromView($file));
                 if ($sourcePath === null) {
                     // var_dump(array('file' => $file, 'type' => $type, 'source' => $arg));
                 } else {
                     $this->assets[$sourcePath] = $type;
                 }
             }
         }
     }
 }
예제 #2
0
 public function render($templatePath, $data = array())
 {
     $this->templatePath = $templatePath;
     $this->data = $data;
     $this->context = str_replace('//', '/', ResolverHelper::getModulePathFromView($templatePath) . '/');
     //        $trace=debug_backtrace();
     //        $caller=array_shift($trace);
     //
     //        debug($caller);
     $buffer = $this->__render();
     if (!$this->hasBlock('content')) {
         $this->setBlock('content', $buffer);
     }
     return $buffer;
 }