2016-09-14 3 views
1

Joomla 웹 사이트에서 lessphp를 사용하고 있습니다. 템플릿을 작성 중이며 일부 변수를 설정하고 적은 파일에서 사용하고 싶습니다.lessphp가 변수 오류로 전달 된 구문 분석에 실패했습니다.

이 내 lessphp 코드 :

실패 클래스 autoCompileLess를 사용하지만이 오류가 발생하고있어 변수 @font 전달 구문 분석 할 수

 


    require_once "lessc.inc.php"; 

    $less = new lessc; 

    //$css_print .= $less->compile("body {font-family: @bfont;} .vikqt_box {font-family:@font;}"); 
    // create a new cache object, and compile 
    function autoCompileLess($inputFile, $outputFile) { 
     // load the cache 
     $cacheFile = $inputFile.".cache"; 

     if (file_exists($cacheFile)) { 
     $cache = unserialize(file_get_contents($cacheFile)); 
     } else { 
     $cache = $inputFile; 
     } 

     $less = new lessc; 

     $less->setVariables(array(
     "font" => $fontname, 
     "bfont" => $bfontname 
     )); 
     $newCache = $less->cachedCompile($cache); 

     if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) { 
     file_put_contents($cacheFile, serialize($newCache)); 
     file_put_contents($outputFile, $newCache['compiled']); 
     } 
    } 

    autoCompileLess(JPATH_SITE.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$this->template.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.less', JPATH_SITE.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$this->template.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'output.css'); 

 

내가 확인하면 비록 output.css 파일 내 .less 파일이 올바르게 컴파일 된 것을 볼 수 있으므로 왜이 오류가 발생하는지 알 수 없습니다. 누군가 나에게 조언 할 수 있습니까? 감사합니다.

답변

1

vars $ fontname 및 $ bfontname을 함수에 설정하지 않은 것 같습니다.