Date: 05/19/00
- Next message: J C Lawrence: "[phplib] PHPLib 7.3-dev"
- Previous message: J C Lawrence: "Re: [phplib] Subtract one day from a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Lines 175 - 181:
} else {
reset($handle);
while(list($i, $h) = each($handle)) {
$str = $this->subst($h);
$this->set_var($target, $str);
}
}
When you specify an array of templates, each iteration overwrites the last, so
$target only contains a parsed version of the final template in the array.
Possible fixes:
} else {
if (!$append)
$this->set_var($target, "");
reset($handle);
while(list($i, $h) = each($handle)) {
$str = $this->subst($h);
$this->set_var($target, $this->get_var($target) . $str);
}
}
I find it cleaner to replace the whole parse function with
function parse($target, $handle, $append = false) {
if (!$append)
$this->set_var($target, "");
if (!is_array($handle)) {
$str = $this->subst($handle);
$this->set_var($target, $this->get_var($target) . $str);
} else {
reset($handle);
while(list($i, $h) = each($handle)) {
$str = $this->subst($h);
$this->set_var($target, $this->get_var($target) . $str);
}
}
return $str;
}
Note: I'm not subscribed to this list, so please reply to all to discuss this.
-- Brian
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: J C Lawrence: "[phplib] PHPLib 7.3-dev"
- Previous message: J C Lawrence: "Re: [phplib] Subtract one day from a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

