<?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <refentry id="function.tidyNode-isPhp"> <refnamediv> <refname>tidyNode->isPhp</refname> <refpurpose> Returns true if this node is PHP </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>tidyNode->isPhp</methodname> <void/> </methodsynopsis> <para> Returns &true; if the current node is PHP code, &false; otherwise. </para> <para> <example> <title>get the PHP code from a mixed HTML/PHP document</title> <programlisting role="php"> <![CDATA[ <?php $html = <<< HTML <html><head> <?php echo '<title>title</title>'; ?> </head> <body> <?php echo 'hello world!'; ?> </body></html> HTML; $tidy = tidy_parse_string($html); $num = 0; get_php($tidy->html()); function get_php($node) { // check if the current node is PHP code if($node->isPhp()) { echo "\n\n# PHP node #" . ++$GLOBALS['num'] . "\n"; echo $node->value; } // check if the current node has childrens if($node->hasChildren()) { foreach($node->child as $child) { get_php($child); } } } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ # PHP node #1 <?php echo '<title>title</title>'; ?> # PHP node #2 <?php echo 'hello world!'; ?> ]]> </screen> </example> </para> <note> <para> This function was named <function>tidy_node->is_php</function> in PHP 4/Tidy 1. </para> </note> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->