Re: XML_FastCreate child appending
| From: | Sönke Ruempler | Date: | Wed, 07 Jul 2004 10:01:41 +0000 |
| Subject: | Re: XML_FastCreate child appending | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13517@lists.php.net to get a copy of this message | ||
Hi and thx for your help,
> > In the case that i open a tag but i don't know which and how many childs
> > follow, i was looking for a method to add the childs dynamicly, not in
one
> > step.
> >
> > With you second example there is the problem again that i can add one
child
> > but then cannot append more childs to the div tag, right?
> Yes, you must construct $blah before, and call the $x->div($blah) after.
Here a simple example:
$xml .= '<div>';
$xml .= '<span>blah</span>';
if ($blah == $blub) {
$xml .= '<span>blub</span>';
}
$xml .= '<ul>';
for ($i = 0; $i < 5; $i++) {
$xml .= '<li>' . $i . '</li>';
}
$xml .= '</ul>';
$xml .= '</div>';
Can i do that with XML_FastCreate? ;-)