I am not sure if I understand your goal for this, however this is what I used to create printer friendly version of the one website:
On the page our template system:
<a href="print.php">Click here for printer friendly</a>
<!-- begin print -->
<table>
<tr>
<td><b>Name</b></td>
<td><b>Other name</b></td>
</tr>
<tr>
<td>lalala</td>
<td>qwe</td>
</tr> <tr>
<td>lalala</td>
<td>qwe</td>
</tr> <tr>
<td>lalala</td>
<td>qwe</td>
</tr>
</table>
<!-- end print -->
** notice the <!-- begin and end print tags-->
Now create a print.php file like this:
$reffer = $_SERVER['HTTP_REFERER'];
$handle = fopen("$reffer", "r");
$read = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$read .= $data;
} while(true);
fclose ($handle);
$search = eregi("<!-- begin print -->(.*)<!-- end print -->", $read, $printing);
$printing[1] = str_replace("", "", $printing[1]);
$content = $printing[1];
$content = explode("ยท", $content);
$p = sizeof($content);
for ($i = 0; $i < $p; $i++) {
$printerfriendly = $content[$i];
if (!$printerfriendly){
print "<b>Sorry most links won't work from the printable version. Please use your browsers back button</b>";
}else{
$timestamp = strtotime("+0 hours 0 minutes");
$time = strftime( "%m/%d/%Y at %I:%M:%S %p",$timestamp);
print "$printerfriendly";
print "<p align=\"center\" class=\"normaltext\">Printed on $time</p>";
}
More information on the fopen can be found at:
http://www.php.net/manual/en/function.fopen.php
I hope this is what you were looking for.
Chris