RE: [Phplib-users] dumping vars in a block
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@if...> - 2001-08-14 17:42:36
|
> anyway to change this so its more like
> $tpl->clear_var("some_block");=20
> and have it clear all the vars that have been set in some_block?
You could do that if you wanted to regex all of the vars in the block. =
My
goal was to gratify my laziness with minimal overhead. I was tired of =
doing:
$tpl->set_var(array("a_var" =3D> "", "another_var" =3D> "", "yet_again"
=3D> "", "ad_nauseum" =3D> ""));
> if there are 20 optional vars, then I would have to call this function =
20
times.
> I'd rather clear them all, and reassign the ones I need to - which =
need to
be reassigned anyway
Look at the function again - that's why it takes a string _or an array_.
$tpl->clear_var(array("a_var", "another_var", "yet_again",
"ad_nauseum"));
Don't worry, I'm not proposing this as the next best improvement for
template.inc; I simply wanted to show that even though this isn't Perl,
still there _is_ more than one way to do it.
Layne Weathers
Ifworld Inc
|