mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- improvement allow fetch() or display() called on a template object to get output from other template
like $template->fetch('foo.tpl') https://github.com/smarty-php/smarty/issues/70
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.28-dev===== (xx.xx.2015)
|
||||
07.07.2015
|
||||
- improvement allow fetch() or display() called on a template object to get output from other template
|
||||
like $template->fetch('foo.tpl') https://github.com/smarty-php/smarty/issues/70
|
||||
|
||||
06.07.2015
|
||||
- optimize {block} compilation
|
||||
- optimization get rid of __get and __set in source object
|
||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.28-dev/22';
|
||||
const SMARTY_VERSION = '3.1.28-dev/24';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@@ -791,7 +791,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
* @throws SmartyException
|
||||
* @return string rendered template output
|
||||
*/
|
||||
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
|
||||
public function fetch($template, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
|
||||
{
|
||||
if ($cache_id !== null && is_object($cache_id)) {
|
||||
$parent = $cache_id;
|
||||
@@ -816,7 +816,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
*/
|
||||
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
public function display($template, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
// display template
|
||||
$this->fetch($template, $cache_id, $compile_id, $parent, true);
|
||||
|
@@ -133,21 +133,33 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* fetches rendered template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws SmartyException
|
||||
* @return string rendered template output
|
||||
*/
|
||||
public function fetch()
|
||||
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
return $this->render(true, false, false);
|
||||
return isset($template) ? $this->smarty->fetch($template, $cache_id, $compile_id, $parent) : $this->render(true, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* displays a Smarty template
|
||||
*
|
||||
* @param string $template the resource handle of the template file or template object
|
||||
* @param mixed $cache_id cache id to be used with this template
|
||||
* @param mixed $compile_id compile id to be used with this template
|
||||
* @param object $parent next higher level of Smarty variables
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function display()
|
||||
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
|
||||
{
|
||||
$this->render(true, false, true);
|
||||
return isset($template) ? $this->smarty->fetch($template, $cache_id, $compile_id, $parent, true) : $this->render(true, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user