Feature Requests item #543468, was opened at 2002-04-14 05:21
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=403614&aid=543468&group_id=31885
Category: None
Group: None
>Status: Closed
Priority: 1
Submitted By: Dipl.-Inform. Kai Hofmann (powerstat)
>Assigned to: Richard Archer (richardarcher)
Summary: unset_var for template.inc!
Initial Comment:
Please add a method unset_var("varname/array") to the template engine.
This is required when handling blocks within blocks!!!!
Because in this situation you have sometime to clear already set variables!
Blocks within blocks can be very power- and helpfull but one ran into strange situations when no
unset_var is available.
Its 5 Minutes of work or less!
Thanks.
----------------------------------------------------------------------
>Comment By: Richard Archer (richardarcher)
Date: 2002-07-12 08:42
Message:
Logged In: YES
user_id=279311
I've added clear_var method which sets the value of an
variable (or array of variables) to "". Also added an
unset_var method which unsets the variable completely. Use
whichever seems appropriate.
This is in the CVS only at this stage. I also merged the
-devel version of template.inc into the -stable tree. I'm
tired of maintaining two versions.
----------------------------------------------------------------------
Comment By: Layne Weathers (layne_weathers)
Date: 2002-07-06 03:03
Message:
Logged In: YES
user_id=278685
You're correct, there are 2 different issues here. In the case of
embedded blocks, setting the variable to "" is adequate
because the variable is going to be reused immediately -
there's no need to destroy it and then recreate it.
On the other hand, I often use 2 Template instances to
minimize the variables parsed during long loops - in this case
I always do a full unset between loops.
FWIW, I discovered some less-than-ideal programming and
variable use when using an actual unset; setting the variable
to "" covered the problem up.
----------------------------------------------------------------------
Comment By: Dipl.-Inform. Kai Hofmann (powerstat)
Date: 2002-07-04 19:27
Message:
Logged In: YES
user_id=286352
Sorry to say, but my experience shows that it is not a
simple set_var("name","") because this is different from a
real unset() !
----------------------------------------------------------------------
Comment By: Layne Weathers (layne_weathers)
Date: 2002-04-16 01:13
Message:
Logged In: YES
user_id=278685
A unset_var() (or clear_var() as I use in my personal
extension) is simply an alias for set_var("varname", "").
Someone may get around to adding such an alias to the
official library, but it is far less urgent than many
existing bugs.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=403614&aid=543468&group_id=31885
|