$DisplayTemplate, 'page' => $pagename ); $args = array_merge($defaults, ParseArgs($args) ); // get template if($args[''][1]) $args['template'] = $args[''][1]; $templatename = MakePageName($pagename, $args['template']); if (PageExists($templatename)) $tpage = RetrieveAuthPage($templatename,"read"); if ($tpage) { $template = $tpage['text']; // convert back < and > $template = str_replace('<', '<', $template); $template = str_replace('>', '>', $template); } // get page if(!$args[''][0]) $args[''][0] = $args['page']; if($args[''][0]) $pagename = MakePageName($pagename, $args[''][0]); // get PTVs from page and add to $args $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT); if ($page) { foreach((array)$PageTextVarPatterns as $pat) if (preg_match_all($pat, $page['text'], $match, PREG_SET_ORDER)) foreach($match as $m) $args["{$m[1]}"] = Qualify($pagename, $m[2]); } else return "
ERROR: Cannot read '[[$pagename]]'
"; // removing not needed elements unset($args['#'], $args[''], $args['page'], $args['template']); // restoring line breaks, removing \\ foreach($args as $k => $v) { $args[$k] = preg_replace('/\\n/','
', $args[$k]); $args[$k] = preg_replace('/\\\\/','', $args[$k]); } // if no template or template not wanted output a simple template to show all PTVs if($template=='' OR $args['template']==='0') { $template = "
PTV data on page [[$pagename]] :
\n"; foreach($args as $k => $v) { $template .= "%blue%".$k." : %%"; $template .= "{\$\$".$k."}
\n"; } $template .= "
"; } //replace {$$var} with PTV values return preg_replace("/\\{\\$\\$([A-Za-z][-_:.\\w\\[\\]]*)\\}/e","stripmagic(\$args[PSS('$1')])",$template); } // }}} //EOF