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