$type
,'value' => $value
,'style' => "width:100%;"
);
if ( is_string( $name ) )
$htmlParams['name']=$name;
return new HtmlInput( $htmlParams );
}
}
class HtmlTemplate {
public static function compile(
string $filePath
,array $vars = null
) : ?string {
$content = null;
try {
$fileContent = \darkphp\autoLoad\DwAutoLoad::getFile( "file://".$filePath );
if ( is_string( $fileContent ) ) {
if ( is_array( $vars ) )
extract($vars);
\ob_start();
$dwHelper = new DwHelper();
include( "data://text/plain,".urlencode( $fileContent ) );
$content = \ob_get_clean();
} else
$content ="Echec getFile:${filePath}";
} catch(\Exception $exception) {
$content ="Exception
$exception";
} catch(\Error $error) {
$content ="Error
$error";
}
return $content;
}
/*
public function getClassName( bool $fqcn=null ) : string {
return self::getStaticClassName( $fqcn );
}
public static function getStaticClassName( bool $fqcn=null ) : string {
return $fqcn ? parent::getStaticClassName( $fqcn ).self::CLASS_SEPARATOR.__CLASS__ : __CLASS__;
}
*/
public static function getStaticClassName( bool $fqcn=null ) : string {
return __CLASS__;
}
}