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!