Menu

#21 unset_var for template.inc!

closed
None
1
2002-07-11
2002-04-13
No

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.

Discussion

  • Layne Weathers

    Layne Weathers - 2002-04-15
    • priority: 5 --> 1
     
  • Layne Weathers

    Layne Weathers - 2002-04-15

    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.

     
  • Dipl.-Inform. Kai Hofmann

    • summary: unset_vat for template.inc! --> unset_var for template.inc!
     
  • Dipl.-Inform. Kai Hofmann

    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() !

     
  • Layne Weathers

    Layne Weathers - 2002-07-05

    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.

     
  • Richard Archer

    Richard Archer - 2002-07-11
    • assigned_to: nobody --> richardarcher
    • status: open --> closed
     
  • Richard Archer

    Richard Archer - 2002-07-11

    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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.