PHP Doku:: Returns the parent node of the current node - tidynode.getparent.html

Verlauf / Chronik / History: (9) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenTidyThe TidyNode classtidyNode::getParent

Ein Service von Reinhard Neidl - Webprogrammierung.

The TidyNode class

<<The TidyNode class

tidyNode::hasChildren>>

tidyNode::getParent

(PHP 5 >= 5.2.2)

tidyNode::getParentReturns the parent node of the current node

Beschreibung

tidyNode tidyNode::getParent ( void )

Returns the parent node of the current node.

Beispiele

Beispiel #1 tidyNode::hasChildren() example

<?php

$html 
= <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<# 
  /* JSTE code */
  alert('Hello World'); 
#>
 </head>
 <body>
 Hello World
 </body>
</html>

HTML;


$tidy tidy_parse_string($html);
$num 0;

$node $tidy->html()->child[0]->child[0];

var_dump($node->getparent()->name);
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

string(4) "head"

Rückgabewerte

Returns a tidyNode if the node has a parent, or NULL otherwise.


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)