To print the document: $t->print prints the entire document. You don't have to do the inner loop yourself.
| [reply] [d/l] |
I need to put some extra html formatting before the XML before I print it, though, and the formatting depends on the element, so I do need to do the inner loop to get each element. So, I guess I'm still kind of confused here--if paste puts in 2 elements, the actual element and its text, how do you print out the element, and not that secondary text element? Sorry if I sound like a broken record; I still don't understand. Jezzica85
| [reply] |
You can loop through
only the "real" elements by writing next_element( '#ELT').. You could also use the start_tag and end_tag methods for "real" elements and the xml_string element for text ('#PCDATA') element.
Alternatively, and I would reccomend that approach, you could generate the "extra html formating" as part of the document: adding attributes, inserting elements or wrapping existing elements in new ("formating") elements. Then you can output the twig (or parts of it) at once.
| [reply] [d/l] |