diff --git a/change_log.txt b/change_log.txt index 3bbf2a2c..b57f7596 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,5 @@ 04/24/2009 +- changed name of {template} tag to {function} - added new {template} tag 04/23/2009 diff --git a/libs/sysplugins/internal.compile_template.php b/libs/sysplugins/internal.compile_function.php similarity index 71% rename from libs/sysplugins/internal.compile_template.php rename to libs/sysplugins/internal.compile_function.php index 1fb02158..9c82e396 100644 --- a/libs/sysplugins/internal.compile_template.php +++ b/libs/sysplugins/internal.compile_function.php @@ -1,19 +1,19 @@ _get_attributes($args); $save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code); - $this->_open_tag('template', $save); + $this->_open_tag('function', $save); $_name = trim($_attr['name'], "'"); foreach ($_attr as $_key => $_data) { - $compiler->template->properties['template'][$_name]['parameter'][$_key] = $_data; + $compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data; } $compiler->template->extract_code = true; $compiler->template->extracted_compiled_code = ''; diff --git a/libs/sysplugins/internal.compile_templateclose.php b/libs/sysplugins/internal.compile_functionclose.php similarity index 74% rename from libs/sysplugins/internal.compile_templateclose.php rename to libs/sysplugins/internal.compile_functionclose.php index df922d01..2d8458ee 100644 --- a/libs/sysplugins/internal.compile_templateclose.php +++ b/libs/sysplugins/internal.compile_functionclose.php @@ -1,19 +1,19 @@ optional_attributes = array('name'); $_attr = $this->_get_attributes($args); - $saved_data = $this->_close_tag(array('template')); + $saved_data = $this->_close_tag(array('function')); // if name does match to opening tag if (isset($_attr['name']) && $saved_data[0]['name'] != $_attr['name']) { $this->compiler->trigger_template_error('mismatching name attributes "' . $saved_data[0]['name'] . '" and "' . $_attr['name'] . '"'); } $_name = trim($saved_data[0]['name'], "'"); - $compiler->template->properties['template'][$_name]['compiled'] = str_replace("\n",'_%n',$compiler->template->extracted_compiled_code); + $compiler->template->properties['function'][$_name]['compiled'] = str_replace("\n",'_%n',$compiler->template->extracted_compiled_code); $compiler->template->extracted_compiled_code = $saved_data[1]; $compiler->template->extract_code = $saved_data[2]; return true; diff --git a/libs/sysplugins/internal.compile_templatecall.php b/libs/sysplugins/internal.compile_internalfunctioncall.php similarity index 71% rename from libs/sysplugins/internal.compile_templatecall.php rename to libs/sysplugins/internal.compile_internalfunctioncall.php index 8fabfb77..3e435236 100644 --- a/libs/sysplugins/internal.compile_templatecall.php +++ b/libs/sysplugins/internal.compile_internalfunctioncall.php @@ -1,20 +1,20 @@ template->properties['template'][$_name]['parameter'])) { - foreach ($compiler->template->properties['template'][$_name]['parameter'] as $_key => $_value) { + if (isset($compiler->template->properties['function'][$_name]['parameter'])) { + foreach ($compiler->template->properties['function'][$_name]['parameter'] as $_key => $_value) { if (!isset($_attr[$_key])) { - $_output .= "\$_template->assign('$_key',$_value);"; + $_output .= "\$_template->assign('$_key',$_value);\n"; } } } @@ -49,15 +49,15 @@ class Smarty_Internal_Compile_TemplateCall extends Smarty_Internal_CompileBase { if (!empty($_attr)) { // create variables foreach ($_attr as $_key => $_value) { - $_output .= "\$_template->assign('$_key',$_value);"; + $_output .= "\$_template->assign('$_key',$_value);\n"; } } - if (isset($compiler->template->properties['template'][$_name]['compiled'])) { - $_compiled = str_replace(array('_%n',"'"), array('',"\'"), $compiler->template->properties['template'][$_name]['compiled']); - $_output .= "\$_template->compiled_template = '$_compiled'; \$_template->mustCompile = false;"; + if (isset($compiler->template->properties['function'][$_name]['compiled'])) { + $_compiled = str_replace(array('_%n',"'"), array("\n","\'"), $compiler->template->properties['function'][$_name]['compiled']); + $_output .= "\$_template->compiled_template = '$_compiled';\n \$_template->mustCompile = false;\n"; } else { // for recursion - $_output .= "\$_template->compiled_template = \$_smarty_tpl->compiled_template; \$_template->mustCompile = false;"; + $_output .= "\$_template->compiled_template = \$_smarty_tpl->compiled_template;\n \$_template->mustCompile = false;\n"; } // was there an assign attribute if (isset($_assign)) { diff --git a/libs/sysplugins/internal.templatecompilerbase.php b/libs/sysplugins/internal.templatecompilerbase.php index 21265c96..d53fe609 100644 --- a/libs/sysplugins/internal.templatecompilerbase.php +++ b/libs/sysplugins/internal.templatecompilerbase.php @@ -112,10 +112,10 @@ class Smarty_Internal_TemplateCompilerBase extends Smarty_Internal_Base { $this->has_code = true; $this->has_output = false; // compile the smarty tag (required compile classes to compile the tag are autoloaded) - if (isset($this->template->properties['template'][$tag])) { + if (isset($this->template->properties['function'][$tag])) { // template defined by {template} tag $args['name'] = $tag; - $tag = 'templatecall'; + $tag = 'internalfunctioncall'; } if (!($_output = $this->$tag($args, $this)) === false) { if ($_output !== true) {