Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/08/2014, 16:46
juliosansossio
 
Fecha de Ingreso: enero-2011
Mensajes: 73
Antigüedad: 13 años, 3 meses
Puntos: 1
Error con file_get_contents

Buenas gente, el problema que tengo es que utilizo file_get_contents para llamar un archivo en el mismo servidor, todo funciona bien pero el problema es que no ejecuta los codigos PHP que existen en ese archivo llamado via file_get_contents.

Alguna ideA?
Código PHP:
<?php
class Tpl
{
    public static function 
Init($pag)
    {
        
Tpl::Add("header",1);
        
Tpl::Add("$pag");
    }
    
    protected static function 
Add($pag,$type 0)
    {
        if (
$type == 0)
        {
            
$file "$_SERVER[DOCUMENT_ROOT]/mercado/inc/tpl/$pag.php";
        }else{
            
$file "$_SERVER[DOCUMENT_ROOT]/mercado/inc/$pag.php";
        }
        
$html Tpl::verification($file);
        
        if (
$html === FALSE)
        {
            echo 
"Archivo no encontrado";
        }
        else{
        
        
            
$html Tpl::filter($html);
            echo 
$html;
        }
        
        
    }
    
    protected static function 
filter($html)
    {
        global 
$words;
        
        foreach (
$words as $clave => $valor)
        {
            
$html str_replace('%' $clave '%'$valor$html);
        }
        
$search = array('/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s');
        
$replace = array('>','<','\\1');
        
$html preg_replace($search$replace$html);
        return 
$html;
    }
    
    protected static function 
verification($file)
    {
        
$file = @file_get_contents($file);
        
        if (
$file === FALSE)
        {
            return 
false;
        }else{
        
            return 
$file;
        }
    }

}

?>