| 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
 <head><title>Tag selection</title>
 <style type='text/css'>
 p , h2{font-family:Verdana,sans-serif;margin-top:12px;margin-bottom:2px}
 </style>
 </head>
 <body>
 <h2>Selecting some tags</h2>
 <p>The following part of xhtml code has some <div> tags that are needed</p>
 <?php
 require("xhtml_parte_inc.php");
 $source = "
 <span class='uno'>Not selected</span>
 <p>Neither selected</p>
 <div>Select this <div>And also this</div></div>
 ";
 print "<code>".nl2br(htmlentities($source))."</code>";
 $myx = new xhtml_parte($source);
 $divs = $myx->etiquetas(false,"div");
 print "<p>This is a list of selected tags</p><ul>";
 foreach($divs[0] as $dd){
 print "\n<li>".htmlentities($dd)."</li>";
 }
 print "</ul>";
 ?>
 <p>But it may be needed tags that are not <div></p>
 <?php
 $nodivs = $myx->etiquetas(false,"!div");
 print "<p>This is a list of selected tags</p><ul>";
 foreach($nodivs[0] as $dd){
 print "\n<li>".htmlentities($dd)."</li>";
 }
 print "</ul>";
 ?>
 
 <h2>Selecting some tags with attributes</h2>
 <p>The following part of xhtml code has some tags width style attributes</p>
 <?php
 $source = "
 <table>
 <tr><td style='font-size:12'>12 size text</td><td>normal text</td></tr>
 <tr><td>normal text</td><td style='text-decoration:underline'>Underlined text</td></tr>
 </table>";
 print "<code>".nl2br(htmlentities($source))."</code>";
 $myx = new xhtml_parte($source);
 $divs = $myx->etiquetas(false,false,"style");
 print "<p>This is a list of selected tags</p><ul>";
 foreach($divs[0] as $dd){
 print "\n<li>".htmlentities($dd)."</li>";
 }
 print "</ul>";
 ?>
 
 <h2>Getting a tag from a Id</h2>
 <p>The following part of xhtml code has a tags that is needed, and its id is 'two'</p>
 <?php
 $source = "
 <div id='one'>This is a layer</div>
 <div id='two'>This is an other layer</div>
 <div id='tree'>This is yet an other layer</div>";
 print "<code>".nl2br(htmlentities($source))."</code>";
 $myx = new xhtml_parte($source);
 $divs = $myx->etiquetas(false,false,"id","two");
 print "<p>This is a list of selected tags</p><ul>";
 foreach($divs[0] as $dd){
 print "\n<li>".htmlentities($dd)."</li>";
 }
 print "</ul>";
 ?>
 
 </body>
 </html>
 |