I try to use function FmtTemplateVars in a new recipe, and finding some odd behaviour.
The function comment reads: ## FmtTemplateVars uses $vars to replace all occurrences of # {$$key} in $text with $vars['key']. function FmtTemplateVars($text, $vars, $pagename = NULL) { ..... ..... return $text; } Feeding it a template text with some {$$key} and an array of $vars works fine, unless 'key' is a page variable name. For instance {$$Name} will be replaced by the page name. This happens because the function also evaluates page variables, which is fine, but expects them in the template with the same syntax than the standard replacement variables: {$$key} So I think we got a naming conflict, and should really insist on a different syntax for page variables in templates: I suggest to use either {$PageVar} (like it is used on normal pages) or perhaps {$$$PageVar}. Making the change in the preg_replace pattern[1] in the function works in both cases, in my limited tests. I think the first is preferable, as we are all used to it, even though viewing the template would mean that these vars are evaluated and not just appear as placeholders. ~Hans [1] current pattern: $text = preg_replace("/\\{\\$($pat)\\}/e", suggested patterns: a) $text = preg_replace("/\\{($pat)\\}/e", b) $text = preg_replace("/\\{\\$\\$($pat)\\}/e", _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel