1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cSmartyWrapper extends Smarty {
25:
26: 27: 28: 29:
30: public function fetch($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false) {
31: if ($this->templateExists($template) === false) {
32: $moduleId = (int) cRegistry::getCurrentModuleId();
33: if ($moduleId > 0) {
34: $module = new cModuleHandler($moduleId);
35: $template = $module->getTemplatePath($template);
36: }
37: }
38:
39: return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
40: }
41:
42: 43: 44: 45:
46: public function fetchGeneral($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false) {
47: $template = cRegistry::getFrontendPath() . 'templates/' . $template;
48:
49: return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter);
50: }
51:
52: public function display($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL) {
53: global $frontend_debug;
54:
55: if ($frontend_debug['template_display']) {
56: echo("<!-- SMARTY TEMPLATE " . $template . " -->");
57: }
58:
59: return parent::display($template, $cache_id, $compile_id, $parent);
60: }
61:
62: 63: 64: 65:
66: public function displayGeneral($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL) {
67: $this->fetchGeneral($template, $cache_id, $compile_id, $parent, true);
68: }
69:
70: 71: 72: 73: 74: 75: 76: 77: 78: 79:
80: public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) {
81: if ($this->templateExists($template_name) === false) {
82: $moduleId = (int) cRegistry::getCurrentModuleId();
83: if ($moduleId > 0) {
84: $module = new cModuleHandler($moduleId);
85: $template_name = $module->getTemplatePath($template_name);
86: }
87: }
88:
89: return parent::clearCache($template_name, $cache_id, $compile_id, $exp_time, $type);
90: }
91:
92: }