главный файл
<table align="center" border="1" cellpadding="0" cellspacing="0" width="90%">
<tr align="center" bgcolor="#5C6076">
<td width="14%"><font color="#ffffff" size=-1><b>Имя</b></font></td>
<td width="14%"><font color="#ffffff" size=-1><b>Страна</b></font></td>
<td width="14%"><font color="#ffffff" size=-1><b>Телефон</b></font></td>
<td width="14%"><font color="#ffffff" size=-1><b>Qiwi</b></font></td>
<td width="14%"><font color="#ffffff" size=-1><b>E-mail</b></font></td>
<td width="14%"><font color="#ffffff" size=-1><b>Номера лотереи</b></font></td>
<td width="10%"><font color="#ffffff" size=-1><b>Дата</b></font></td>
<td width="6%"><font color="#ffffff" size=-1><b>Delete</b></font></td>
</tr>
<tr align="center">
<?php
include 'show_message.php';
?>
</tr>
</table>
файл с шаблоном
<?php
$filename = "../result/messages.dat";
$delitmer = "<|-|>";
$shablon = '
<tr>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b><u>%name%</u></b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b><u>%country%</u></b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b>%telf%</b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b>%qiwi%</b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b><a href="mailto:%email%">%email%</a></b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b>%nomer%</b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><font color="#000000" size=-1><b>%date%</b></font></td>
<td width="10%" align="center" bgcolor="#ffffff"><input type="checkbox" name=del value="1" /></td>
</tr>
';
$data = @file($filename);
sort($data);
for(reset($data); $key = key($data); next($data)) {
echo "name[$key] = ".$data[$key]."\n";
}
foreach($data as $val)
{
list($name, $country, $telf, $city , $qiwi , $email, $nomer, $date) = explode($delitmer, trim($val));
$tmp_message = str_replace("%name%", $name, $shablon);
$tmp_message = str_replace("%country%", $country, $tmp_message);
$tmp_message = str_replace("%telf%", $telf, $tmp_message);
$tmp_message = str_replace("%city%", $city, $tmp_message);
$tmp_message = str_replace("%qiwi%", $qiwi, $tmp_message);
$tmp_message = str_replace("%email%", $email, $tmp_message);
$tmp_message = str_replace("%nomer%", $nomer, $tmp_message);
$tmp_message = str_replace("%date%", $date, $tmp_message);
echo $tmp_message;
}
?>
текстовый файл