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

Usage Example: FluentDOM::wrapAll()

  1. <?php
  2. /**
  3. *
  4. @version $Id: wrapAll.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>
  15.     <p>Hello</p>
  16.     <p>cruel</p>
  17.   </div>
  18.   <div>
  19.     <p>World</p>
  20.   </div>
  21. </body>
  22. </html>
  23. XML;
  24.  
  25. require_once('../FluentDOM.php');
  26.  
  27. echo FluentDOM($xml)
  28.   ->find('//p')
  29.   ->wrapAll('<div class="wrapper" />');
  30.  
  31. echo "\n\n";
  32.  
  33. echo FluentDOM($xml)
  34.   ->find('//p')
  35.   ->wrapAll('<div class="wrapper"><div>INNER</div></div>');
  36. ?>

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