View Single Post
Old 06-12-2009, 07:55 PM   #8 (permalink)
Sakakuchi
The Contributor
 
Sakakuchi's Avatar
 
Join Date: Feb 2009
Posts: 64
Thanks: 1
Sakakuchi is on a distinguished road
Default

No idea how wildhoney wants to go with eval - but you can do it like:

PHP Code:
<?php
ob_start
();
include(
'file2include.php');
$var ob_get_contents();
ob_end_clean();
?>

<html>
<head></head>
<body><?=$var ?></body>
</html>
and the file which gets included:

PHP Code:
<table>
  <tr>
    <th>Column 1 Heading</th>
    <th>Column 2 Heading</th>
  </tr>
  <tr>
    <td><?='content1' ?></td>
    <td><?='content2' ?></td>
  </tr>
</table>
Would give that output:

HTML Code:
<html>
<head></head>
<body><table>
  <tr>
    <th>Column 1 Heading</th>
    <th>Column 2 Heading</th>
  </tr>
  <tr>
    <td>content1</td>

    <td>content2</td>
  </tr>
</table>
</body>
</html>


Edit: sorry forgot to explain what happens actually:

PHP Code:
<?php
ob_start
(); //This is starting the buffer
include('file2include.php');//now we load the file into the buffer
$var ob_get_contents();// load the buffer to $var
ob_end_clean();//delete the buffer
//and thats it ;-)
?>

Last edited by Sakakuchi : 06-12-2009 at 07:58 PM. Reason: forgot to add description
Sakakuchi is offline  
Reply With Quote