Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/12/2008, 07:14
Avatar de pateketrueke
pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Pasar contenido de un script a una variable

mm, tal ves necesites usar los buffers...

Código PHP:
function incluye($inc$vars = array())
{
  if (
is_file($inc))
  {
    
ob_start();

    
extract($vars);
    include 
$inc;

    
$out ob_get_contents();
    
ob_end_clean();

    return 
$out;
  }

lo que hace esta función improvisada, es cargar un include con variables en su contexto, es mas o menos lo que se usa en MVC ...

test.php
Código PHP:
$data = array(
  
'title' => 'Titulo?',
  
'body' => 'Hola mundo!'
);

$html incluye('plantilla.htm'$data);
// echo $html; 

plantilla.htm
Código HTML:
<html>
  <head>
    <title><?php echo $title; ?></title>
  </head>
  <body>
    <?php echo $body; ?>
  </body>
</html> 
espero te alivie, suerte!
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.