private static function parse($file, $data)
    {
        $file = file_get_contents($file, FILE_USE_INCLUDE_PATH);

        // Go through each variable and replace the values
        foreach($data as $key => $value)
        {
            $pattern = '{{{' . $key . '}}}';
            $file = preg_replace($pattern, $value, $file);
        }

        if(!!$file)
        {
            return $file;
        }

        return false;
    }
private static function parse($file, $data)
    {
        $file = file_get_contents($file, FILE_USE_INCLUDE_PATH);

        // Go through each variable and replace the values
        foreach($data as $key => $value)
        {
            $pattern = '{{{' . $key . '}}}';
            $file = preg_replace($pattern, $value, $file);
        }

        if(!!$file)
        {
            return $file;
        }

        return false;
    }
private static function parse ( $ file , $ data ) { $ file = file_get_contents ( $ file , FILE_USE_INCLUDE_PATH ) ; // Go through each variable and replace the values foreach ( $ data as $ key => $ value ) { $ pattern = '{{{' . $ key . '}}}' ; $ file = preg_replace ( $ pattern , $ value , $ file ) ; } if ( ! ! $ file ) { return $ file ; } return false ; }
Parse a template with some data.

@param string $file The template file we want the data to be put into
@param array $data The data structure
@return string|boolean The filled-put template OR false
Parse a template with some data .