Re: [SMARTY] Problem with ConfigFiles (scope global)
| From: | Norbert Röcher | Date: | Thu, 16 May 2002 21:59:00 +0000 |
| Subject: | Re: [SMARTY] Problem with ConfigFiles (scope global) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4253@lists.php.net to get a copy of this message | ||
"Monte Ohrt" <monte@ispi.net> schrieb:
> Sorry to hear that. I just don't understand what you're trying to
> accomplish or exactly how things are setup. Maybe an explicit
example of
> scripts/templates to demonstrate the problem would help.
>
I just tried to include fetched templates by {insert}. That's all, in
fact. The problem is, that config_vars with scope "global" were only
available in the main template und not available while fetching the
sub-templates within my insert-function - using the same
smarty-object, while this object definetly contains all necessary
data. To me this seems to be a bug in smarty.
Simplified code:
_____________________________________
PHP_APPLICATION:
$smarty->assign(id, $id);
$smarty->display('index.tpl');
INDEX.TPL:
{config_load file="styles.conf" scope=global}
{insert name=block id=$id}
STYLES.CONF:
color1=00000
color2=FFFFF
SMARTY_INSERT_BLOCK.PHP:
function smarty_insert_block ($params, &$smarty)
{
$data = getBlockDataByID($params['id']);
$smarty->assign('content', $data['content']);
return $smarty->fetch($data['subtemplate']);
}
SUBTEMPLATE.TPL:
{#color1#} {*should contain value from style.conf, but doesn't*}
{#color2#} {*should contain value from style.conf, but doesn't*}
_____________________________________
Regards,
Norbert