Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
  6. <title>PHP LibDiff - Examples</title>
  7. <link rel="stylesheet" href="styles.css" type="text/css" charset="utf-8"/>
  8. </head>
  9. <body>
  10. <h1>PHP LibDiff - Examples</h1>
  11. <hr />
  12. <?php
  13. // Include the diff class
  14. require_once dirname(__FILE__).'/../lib/Diff.php';
  15. // Include two sample files for comparison
  16. $a = explode("\n", file_get_contents(dirname(__FILE__).'/a.txt'));
  17. $b = explode("\n", file_get_contents(dirname(__FILE__).'/b.txt'));
  18. // Options for generating the diff
  19. $options = array(
  20. //'ignoreWhitespace' => true,
  21. //'ignoreCase' => true,
  22. );
  23. // Initialize the diff class
  24. $diff = new Diff($a, $b, $options);
  25. ?>
  26. <h2>Side by Side Diff</h2>
  27. <?php
  28. // Generate a side by side diff
  29. require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/SideBySide.php';
  30. $renderer = new Diff_Renderer_Html_SideBySide;
  31. echo $diff->Render($renderer);
  32. ?>
  33. <h2>Inline Diff</h2>
  34. <?php
  35. // Generate an inline diff
  36. require_once dirname(__FILE__).'/../lib/Diff/Renderer/Html/Inline.php';
  37. $renderer = new Diff_Renderer_Html_Inline;
  38. echo $diff->render($renderer);
  39. ?>
  40. <h2>Unified Diff</h2>
  41. <pre><?php
  42. // Generate a unified diff
  43. require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Unified.php';
  44. $renderer = new Diff_Renderer_Text_Unified;
  45. echo htmlspecialchars($diff->render($renderer));
  46. ?>
  47. </pre>
  48. <h2>Context Diff</h2>
  49. <pre><?php
  50. // Generate a context diff
  51. require_once dirname(__FILE__).'/../lib/Diff/Renderer/Text/Context.php';
  52. $renderer = new Diff_Renderer_Text_Context;
  53. echo htmlspecialchars($diff->render($renderer));
  54. ?>
  55. </pre>
  56. </body>
  57. </html>