public static function Render($template_name, $localized_strings, $data) { global $template_global_vars, $cphp_debug_enabled; $data = array_merge($data, $template_global_vars); $templater = new NewTemplater(); $templater->Load($template_name); $templater->Localize($localized_strings); $templater->Parse(); if ($cphp_debug_enabled === true) { echo $templater->root->PrintDebug(0, true); } $result = $templater->Evaluate($localized_strings, $data); $result = CSRF::InsertTokens($result); return $result; }
public static function Render($template_name, $localized_strings, $data, $presets = array()) { global $template_global_vars, $cphp_debug_enabled; $data = array_merge($data, $template_global_vars); $templater = new NewTemplater(); $templater->Load($template_name); $templater->Localize($localized_strings); $templater->Parse(); if ($cphp_debug_enabled === true) { echo $templater->root->PrintDebug(0, true); } if (!empty($presets)) { foreach ($presets as $preset_key => $preset_value) { $templater->SetPreset($preset_key, $preset_value); } } $result = $templater->Evaluate($localized_strings, $data); $result = CSRF::InsertTokens($result); return $result; }