mirror of
https://github.com/smarty-php/smarty.git
synced 2026-04-29 02:03:31 +02:00
- improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource
https://github.com/smarty-php/smarty/issues/296
This commit is contained in:
@@ -37,10 +37,11 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
|
||||
$uid = '';
|
||||
$sources = array();
|
||||
$components = explode('|', $source->name);
|
||||
$smarty = &$source->smarty;
|
||||
$exists = true;
|
||||
foreach ($components as $component) {
|
||||
/* @var \Smarty_Template_Source $_s */
|
||||
$_s = Smarty_Template_Source::load(null, $source->smarty, $component);
|
||||
$_s = Smarty_Template_Source::load(null, $smarty, $component);
|
||||
if ($_s->type == 'php') {
|
||||
throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
|
||||
}
|
||||
@@ -85,7 +86,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
|
||||
public function getContent(Smarty_Template_Source $source)
|
||||
{
|
||||
if (!$source->exists) {
|
||||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
||||
throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'");
|
||||
}
|
||||
|
||||
$_components = array_reverse($source->components);
|
||||
|
||||
Reference in New Issue
Block a user