короче привожу часть кода
$template = LoadTemplate($PageArray[\'ModelID\']);
$FullTemplate = $template[\'Template\'];
eval("echo \\"".$FullTemplate."\\";");
function LoadTemplate($PageModelID) {
global $PageID, $template;
$SQL = "SELECT * FROM `models` WHERE `ModelID` = \'".$PageModelID."\';";
$Result = mysql_query($SQL);
$template = mysql_fetch_array($Result);
mysql_free_result($Result);
$template[\'Template\'] = str_replace(\'%Header\', $template[\'Template\'], $template[\'Template\']);
$template[\'CountPlaces\'] = preg_match_all(\'/##place[0-9]+##/\', $template[\'Template\'], $W);
for ($i=0; $i < $template[\'CountPlaces\']; $i++) {
$TemplateWithObjects[] = CountTemplates($PageModelID, $i);
$template[\'Template\']= str_replace("##place".($i+1)."##", "`".$TemplateWithObjects[$i]."`", $template[\'Template\']);
}
return $template;
}
function CountTemplates($PageModelID, $i) {
global $PageID;
$SQL2 = "SELECT RazdelID, TemplateID, ModulID
FROM model_places
WHERE PageID = ".$PageID." AND ModelID = ".$PageModelID." AND PlaceID = ".$i.";";
$Result2 = mysql_query($SQL2);
$PlaceArray = DBResultToArray($Result2);
for ($y=0; $y < count($PlaceArray); $y++) {
if ($PlaceArray[$y][\'TemplateID\']) {
$Objects = CountObjects($PlaceArray[$y][\'RazdelID\']);
} else if ($PlaceArray[$y][\'ModulID\']) {
$SQL = "SELECT IncludeUrl FROM modules WHERE ModuleID = \'".$PlaceArray[$y][\'ModulID\']."\';";
$Result = mysql_query($SQL);
list ($IncludeUrl) = mysql_fetch_row($Result);
mysql_free_result($Result);
$Objects ==
?
}
$TemplateWithObjects .= $Objects;
}
return $TemplateWithObjects;
}