RE: Prefilters & Assign
| From: | Andreas Heintze | Date: | Sun, 10 Mar 2002 15:14:16 +0000 |
| Subject: | RE: Prefilters & Assign | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3004@lists.php.net to get a copy of this message | ||
It did work if I just added:
$this->_tpl_vars =
in front of array_merge(....
What do you say about this Monte & Andrei? Is this something to add to
Smarty? I think it should be possible to do an assign in a prefilter.
/Andreas
-----Ursprungligt meddelande-----
Från: Martin Søndergård Andersen [mailto:martin@inleadmedia.com]
Skickat: den 10 mars 2002 13:15
Till: smarty@lists.ispi.net
Ämne: [smarty] RE: Prefilters & Assign
I guess it's because the prefilter actually is called from a compiler
object.
To get around this "problem" locate the "_compile_template" function in
Smarty.class.php, and replace the lines:
if ($smarty_compiler->_compile_file($tpl_file, $template_source,
$template_compiled))
return true;
with this:
if ($smarty_compiler->_compile_file($tpl_file, $template_source,
$template_compiled))
{
array_merge($this->_tpl_vars, $smarty_compiler->_tpl_vars);
return true;
}
I haven't tested this, but I'm sure it will work.
/Karto
-----Original Message-----
From: Andreas Heintze [mailto:andreas.heintze@home.se]
Sent: 10. marts 2002 11:55
To: smarty@lists.ispi.net
Subject: [smarty] Prefilters & Assign
Why can't I make a $smarty_obj->assign(....); in a prefilter?
/Andreas
---
You are currently subscribed to smarty as: martin@inleadmedia.com
To unsubscribe send a blank email to $subst('Email.Unsub')
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/
---
You are currently subscribed to smarty as: andreas.heintze@home.se
To unsubscribe send a blank email to $subst('Email.Unsub')
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/