<?php
class Plantillas {
public static $variables = array('VARIABLES' => array() , 'DATOS' => array() );
public static function html($rutaPLANTILLA, $variables, $datos) {
$htmlContenido = file_get_contents($rutaPLANTILLA);
$htmlMensaje = str_replace(
$variables, $datos, $htmlContenido
);
return $htmlMensaje;
}
public static function agregarValor($variable, $valor) {
array_push( self::$variables['VARIABLES'], '%%'.$variable.'%%' );
array_push(self::$variables['DATOS'], $valor);
return self::$variables;
}
public static function script($script, $reemplazar) {
$htmlMensaje = str_replace(
$reemplazar['VARIABLES'], $reemplazar['DATOS'], $script
);
return $htmlMensaje;
}
public static function tmpl($rutaPLANTILLA, $reemplazar) {
$htmlContenido = file_get_contents($rutaPLANTILLA);
$htmlMensaje = str_replace(
$reemplazar['VARIABLES'], $reemplazar['DATOS'], $htmlContenido
);
return $htmlMensaje;
}
}