FluentDOM
[ class tree: FluentDOM ] [ index: FluentDOM ] [ all elements ]

Usage Example: FluentDOM::prevAll()

  1. <?php
  2. /**
  3. *
  4. @version $Id: prevAll.php 322 2009-09-14 20:19:48Z subjective $
  5. @license http://www.opensource.org/licenses/mit-license.php The MIT License
  6. @copyright Copyright (c) 2009 Bastian Feder, Thomas Weinert
  7. */
  8. header('Content-type: text/plain');
  9.  
  10. $xml = <<<XML
  11. <html>
  12. <head></head>
  13. <body>
  14.   <div><span>has child</span></div>
  15.   <div id="start"></div>
  16.   <div></div>
  17.   <div><span>has child</span></div>
  18.   <div class="here"><span>has child</span></div>
  19.   <div><span>has child</span></div>
  20.   <div class="here"></div>
  21.   <div></div>
  22.   <p><button>Go to Prev</button></p>
  23. </body>
  24. </html>
  25. XML;
  26.  
  27. require_once('../FluentDOM.php');
  28. echo FluentDOM($xml)
  29.   ->find('//div[@id = "start"]')
  30.   ->prevAll()
  31.   ->addClass('before');
  32.  
  33. echo "\n\n";
  34.  
  35. echo FluentDOM($xml)
  36.   ->find('//div[@class= "here"]')
  37.   ->prevAll('.//span')
  38.   ->addClass('nextTest');
  39. ?>

Documentation generated on Sun, 26 Sep 2010 01:00:50 +0200 by phpDocumentor 1.4.3