Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/11/2005, 14:45
Taurus427
 
Fecha de Ingreso: agosto-2003
Mensajes: 398
Antigüedad: 20 años, 8 meses
Puntos: 0
Clase para Plantillas

Hola, tengo esta clase para aplicar plantillas a mis php, pero me gustaria que me digerais si puede provocar sobrecarga en el servidor usarla, en caso de que sea perjudicial hay alguna alternativa?

Código PHP:
class plantilla{
        function 
plantilla($template_file){
        global 
$theme;
                
$this->tpl_file 'themes/'.$theme.'/templates/' $template_file '.tpl';
        }
        
        function 
asigna_variables($vars){
                
$this->vars= (empty($this->vars)) ? $vars $this->vars $vars;
        }

        function 
muestra(){
                if (!(
$this->fd = @fopen($this->tpl_file'r'))) {
                        
sostenedor_error('error al abrir la plantilla ' $this->tpl_file);
                } else{
                        
$this->template_file fread($this->fdfilesize($this->tpl_file));
                        
fclose($this->fd);
                        
$this->mihtml $this->template_file;
                        
$this->mihtml str_replace ("'""\'"$this->mihtml);
                        
$this->mihtml preg_replace('#\{([a-z0-9\-_]*?)\}#is'"' . $\\1 . '"$this->mihtml);
                        
reset ($this->vars);
                        while (list(
$key$val) = each($this->vars)) {
                                $
$key $val;
                        }
                        eval(
"\$this->mihtml = '$this->mihtml';");
                        
reset ($this->vars);
                        while (list(
$key$val) = each($this->vars)) {
                                unset($
$key);
                        }
                        
$this->mihtml=str_replace ("\'""'"$this->mihtml);
                        echo 
$this->mihtml;
                }
        }