note
mirod
<p>The easiest way is to do <a href="http://xmltwig.com/xmltwig/twig_dev.html#METHODS_XML_Twig_Elt_in"><code>$elt->in( $parent)</code></a>. If you only have the ID of the parent, as it happens, those are stored and you can use <a href="http://xmltwig.com/xmltwig/twig_dev.html#METHODS_XML_Twig_elt_id"><code>$twig->elt_id( $parent_id)</code></a> to get the element itself.</p>
<p><tt>elt_id</tt> is fast, it is just a hash look-up, but <tt>in</tt> has to walk the ancestors of the element. I would be surprised if this was a real bottleneck in an application though.Does it really cause you performance problems? In that case it would help if you could show us a bit of code (and the associated data).</p>
284168
284168