Dynamic
<?php
function DynamicRows($Prefix="", $LoadTemplate="", $RowName="", $RowValue="")
{
// start loopings
$tcontent = $LoadTemplate;
$startlist = strpos($tcontent,"<!--%".$Prefix."_BEGIN_MESSAGE_LIST%-->");
$endlist = strpos($tcontent,"<!--%".$Prefix."_END_MESSAGE_LIST%-->")+28;
$listline = substr($tcontent,$startlist+30,$endlist-$startlist-58);
$listlinetoreplace = substr($tcontent,$startlist,$endlist-$startlist);
$startlistloop = strpos($tcontent,"<!--%".$Prefix."_ML_LOOPBEGIN%-->");
$endlistloop = strpos($tcontent,"<!--%".$Prefix."_ML_LOOPEND%-->")+22;
$listloop =
substr($tcontent,$startlistloop+24,$endlistloop-$startlistloop-46);
$beforeloop = substr($listline,0,strpos($listline,"<!--%".$Prefix."_ML_LOOPBEGIN%-->"));
$afterloop = substr($listline,strpos($listline,"<!--%".$Prefix."_ML_LOOPEND%-->")+22);
$newmsgs = 0;
for($i=0;$i<count($headers);$i++) {
if(!$headers[$i]["read"]) $newmsgs++;
$msglist .= eregi_replace("<!--%POLERIODUMMY%-->","Polerio",$beforeloop);
$start_pos=0;$end_pos=(count($RowValue));
for($i=$start_pos;$i<$end_pos;$i++) {
$thisline = "$listlooprn";
$s_pos=0;$e_pos=count($RowName);
for($j=$s_pos;$j<$e_pos;$j++) {
$thisline = eregi_replace($RowName[$j],$RowValue[$i][$j],$thisline);
}
}
$msglist .= $thisline;
} // end for
$msglist .= $afterloop;
$tcontent = substr($tcontent,0,$startlist).$msglist.substr($tcontent,$endlist,strlen($tcontent));
// end loopings
return $tcontent;
}
?>