note 61963 added to function.domdocument-get-element-by-id

From: Date: Thu, 16 Feb 2006 03:40:14 +0000
Subject: note 61963 added to function.domdocument-get-element-by-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-103825@lists.php.net to get a copy of this message
get_element_by_id does not work on my version of php :( This reallyGet_element_by_id function is a easy replacenemt. <?php /** * Get a node by its id 'attribute' value * * The attribute name id has to be spelled lowercase in xml file * * @return node on success and null in failure. * @param string An id to look for. */ function reallyGet_element_by_id( $str_id ){ $node_with_id = null; $xpath = xpath_new_context($this->dom); $xpresult = xpath_eval($xpath, "//@id"); foreach( $xpresult->nodeset as $node ){ if ($node->value == $str_id) return $node->parent_node( ); } return $node_with_id; } ?> ---- Server IP: 216.235.15.211 Probable Submitter: 70.26.14.245 ---- Manual Page -- http://www.php.net/manual/en/function.domdocument-get-element-by-id.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61963 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61963&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61963&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103825) next »