[Chameleon-dev] [Bug 502] [Chameleon] Recursive preprocessing
enhancement
bugzilla-daemon at www.maptools.org
bugzilla-daemon at www.maptools.org
Wed Jul 7 14:16:40 EDT 2004
http://www.maptools.org/bugzilla/show_bug.cgi?id=502
------- Additional Comments From jlacroix at dmsolutions.ca 2004-07-07 14:16 -------
To avoid to much performance hit we can also do a linear parsing. I mean do the
replacement and in the include step, take the file to include and do the
replacement on only its content, not the whole Chameleon template 2-3 times.
What do you think?
function ProcessReplacement($szTextToReplace)
{
$szTextToReplace = preg_replace_callback("/(\\[$(.*?)$\\])/",
"GetReplacement", $szTextToReplace);
$szTextToReplace = preg_replace_callback("/(\\[#(.*?)#\\])/", "GetInclude",
$szTextToReplace);
return $szTextToReplace;
}
GetReplacement( $szTextToReplace )
{
....
}
GetInclude( $aszTextToReplace )
{
// Get the file to include
$szTemplateName = $aszTextToReplace[2];
$szTemplate = implode("\n", file($szTemplateName));
// Reprocess only the file to include
$szTemplate = ProcessReplacement($szTemplate);
return
}
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Chameleon-dev
mailing list