} // END - if
// Calls back a function based on given XML template data
-function showEntriesByXmlCallback ($template) {
+function showEntriesByXmlCallback ($template, $content = array(), $compileCode = true) {
// Generate FQFN for with special path
$FQFN = sprintf("%stemplates/xml/%s%s.xml",
getPath(),
- detectExtraTemplatePath($template),
+ detectExtraTemplatePath('xml', $template),
$template
);
// Is it again readable?
if (isFileReadable($FQFN)) {
- // Read it
- $templateContent = readFromFile($FQFN);
+ // Is there cache?
+ if ((!isDebuggingTemplateCache()) && (isTemplateCached('xml', $template))) {
+ // Evaluate the cache
+ eval(readTemplateCache('xml', $template));
+ } else {
+ // Read it
+ $templateContent = readFromFile($FQFN);
+
+ // Prepare it for finaly eval() command
+ $GLOBALS['template_eval']['xml'][$template] = '$templateContent = decodeEntities("' . compileRawCode(escapeJavaScriptQuotes($templateContent), false, true, true, $compileCode) . '");';
+
+ // Eval the code, this does insert any array elements from $content
+ eval($GLOBALS['template_eval']['xml'][$template]);
+ }
// Init main arrays
$GLOBALS['__XML_CALLBACKS'] = array(
// Adds special elements by calling back another template-depending function
function addXmlSpecialElements ($template) {
- // Generate the FQCN (Full-Qualified CallbackName)
+ // Generate the FQCN (Full-Qualified Callback Name)
$FQCN = 'addXmlSpecial' . capitalizeUnderscoreString($template);
// Is it there?