"; return $ret; } function tplExtrSection($tpl, $section) { //Extracts a section from a template tplCheckMarker($section); $start = tplMakeSectionMarker($section, "START"); $end = tplMakeSectionMarker($section, "END"); $start = strpos($tpl, $start)+strlen($start); $end = strrpos($tpl, $end); if (($start===false) || ($end===false) || ($end<=$start)) return ""; return substr($tpl, $start,$end-$start); } function tplReplSection($tpl, $section, $value) { //replaces a section in a template with a value tplCheckMarker($section); $start = tplMakeSectionMarker($section, "START"); $end = tplMakeSectionMarker($section, "END"); $start = strpos($tpl, $start); $end = strrpos($tpl, $end)+strlen($end); if (($start===false) || ($end===false) || ($end<=$start)) return $tpl; $ret = ($start>0 ? substr($tpl, 0, $start) : ""); $ret.= $value; if ($end0 ? substr($tpl, 0, $start) : ""); $ret.= $value; if ($end $val) { tplCheckMarker($ind); $tpl = str_replace($ind, $val, $tpl); } return $tpl; }