public static function includeFile($file)
    {
        $data               = static::$properties['data'];
        $templatePath       = static::$properties['templatePath'];
        $compilePath        = static::$properties['compilePath'];
        $compileCached      = static::$properties['compileCached'];
        $compileFileNameMd5 = static::$properties['compileFileNameMd5'];
        $compileFileSuffix  = static::$properties['compileFileSuffix'];
        $templateFile       = $templatePath . $file;

        if ( !file_exists($templateFile) )
        {
            throw new \InvalidArgumentException('included template file ' . $file . ' not found.');
        }

        $pathInfo = pathinfo($file);
        $filename = $pathInfo['filename'];

        if (!$compileFileNameMd5 && !file_exists($compilePath . $pathInfo['dirname']))
        {
            static::mkdir($compilePath . $pathInfo['dirname']);
        }

        $filenameMd5 = (($compileFileNameMd5) ? md5(md5($filename)) : $pathInfo['dirname'] . DIRECTORY_SEPARATOR . $filename);
        $compileFile = $compilePath . $filenameMd5 . $compileFileSuffix;

        if ($compileCached)
        {
            if (!file_exists($compileFile) || (filemtime($templateFile) > filemtime($compileFile)))
            {
                $tpl = file_get_contents($templateFile);
                $tpl = static::parser($tpl);
                file_put_contents($compileFile, $tpl);
            }
        }
        else
        {
            $tpl = file_get_contents($templateFile);
            $tpl = static::parser($tpl);
            file_put_contents($compileFile, $tpl);
        }

        return $compileFile;
    }
public static function includeFile($file)
    {
        $data               = static::$properties['data'];
        $templatePath       = static::$properties['templatePath'];
        $compilePath        = static::$properties['compilePath'];
        $compileCached      = static::$properties['compileCached'];
        $compileFileNameMd5 = static::$properties['compileFileNameMd5'];
        $compileFileSuffix  = static::$properties['compileFileSuffix'];
        $templateFile       = $templatePath . $file;

        if ( !file_exists($templateFile) )
        {
            throw new \InvalidArgumentException('included template file ' . $file . ' not found.');
        }

        $pathInfo = pathinfo($file);
        $filename = $pathInfo['filename'];

        if (!$compileFileNameMd5 && !file_exists($compilePath . $pathInfo['dirname']))
        {
            static::mkdir($compilePath . $pathInfo['dirname']);
        }

        $filenameMd5 = (($compileFileNameMd5) ? md5(md5($filename)) : $pathInfo['dirname'] . DIRECTORY_SEPARATOR . $filename);
        $compileFile = $compilePath . $filenameMd5 . $compileFileSuffix;

        if ($compileCached)
        {
            if (!file_exists($compileFile) || (filemtime($templateFile) > filemtime($compileFile)))
            {
                $tpl = file_get_contents($templateFile);
                $tpl = static::parser($tpl);
                file_put_contents($compileFile, $tpl);
            }
        }
        else
        {
            $tpl = file_get_contents($templateFile);
            $tpl = static::parser($tpl);
            file_put_contents($compileFile, $tpl);
        }

        return $compileFile;
    }
public static function includeFile ( $ file ) { $ data = static :: $ properties [ 'data' ] ; $ templatePath = static :: $ properties [ 'templatePath' ] ; $ compilePath = static :: $ properties [ 'compilePath' ] ; $ compileCached = static :: $ properties [ 'compileCached' ] ; $ compileFileNameMd5 = static :: $ properties [ 'compileFileNameMd5' ] ; $ compileFileSuffix = static :: $ properties [ 'compileFileSuffix' ] ; $ templateFile = $ templatePath . $ file ; if ( ! file_exists ( $ templateFile ) ) { throw new \ InvalidArgumentException ( 'included template file ' . $ file . ' not found.' ) ; } $ pathInfo = pathinfo ( $ file ) ; $ filename = $ pathInfo [ 'filename' ] ; if ( ! $ compileFileNameMd5 && ! file_exists ( $ compilePath . $ pathInfo [ 'dirname' ] ) ) { static :: mkdir ( $ compilePath . $ pathInfo [ 'dirname' ] ) ; } $ filenameMd5 = ( ( $ compileFileNameMd5 ) ? md5 ( md5 ( $ filename ) ) : $ pathInfo [ 'dirname' ] . DIRECTORY_SEPARATOR . $ filename ) ; $ compileFile = $ compilePath . $ filenameMd5 . $ compileFileSuffix ; if ( $ compileCached ) { if ( ! file_exists ( $ compileFile ) || ( filemtime ( $ templateFile ) > filemtime ( $ compileFile ) ) ) { $ tpl = file_get_contents ( $ templateFile ) ; $ tpl = static :: parser ( $ tpl ) ; file_put_contents ( $ compileFile , $ tpl ) ; } } else { $ tpl = file_get_contents ( $ templateFile ) ; $ tpl = static :: parser ( $ tpl ) ; file_put_contents ( $ compileFile , $ tpl ) ; } return $ compileFile ; }
Parse & require included template file

@param string $file
@return string
Parse & require included template file