PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/include/Savant/Savant2/tests/2_display.php

https://github.com/radicaldesigns/amp
PHP | 72 lines | 42 code | 19 blank | 11 comment | 0 complexity | 951a9971f04d5010b0c8144cb4320481 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. /**
  3. *
  4. * Tests display() issues
  5. *
  6. * @version $Id: 2_display.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $
  7. *
  8. */
  9. error_reporting(E_ALL);
  10. require_once 'Savant2.php';
  11. $conf = array(
  12. 'template_path' => 'templates',
  13. 'resource_path' => 'resources'
  14. );
  15. $savant = new Savant2($conf);
  16. $array = array(
  17. 'key0' => 'val0',
  18. 'key1' => 'val1',
  19. 'key2' => 'val2',
  20. );
  21. $var1 = 'variable1';
  22. $var2 = 'variable2';
  23. $var3 = 'variable3';
  24. $ref1 = 'reference1';
  25. $ref2 = 'reference2';
  26. $ref3 = 'reference3';
  27. // assign vars
  28. $savant->assign($var1, $var1);
  29. $savant->assign($var2, $var2);
  30. $savant->assign($var3, $var3);
  31. // assigns $array to a variable $set
  32. $savant->assign('set', $array);
  33. // assigns the keys and values of array
  34. $savant->assign($array);
  35. // assign references
  36. $savant->assignRef($ref1, $ref1);
  37. $savant->assignRef($ref2, $ref2);
  38. $savant->assignRef($ref3, $ref3);
  39. echo "<h1>Display non-existent template</h1>";
  40. $result = $savant->display('no_such_template.tpl.php');
  41. echo "result: <pre>";
  42. print_r($result);
  43. echo "</pre>";
  44. echo "<h1>Storage</h1>";
  45. echo "properties: <pre>";
  46. print_r(get_object_vars($savant));
  47. echo "</pre>";
  48. echo "<h1>Display existing template</h1>";
  49. $result = $savant->display('test.tpl.php');
  50. echo "result: <pre>";
  51. var_dump($result);
  52. echo "</pre>";
  53. ?>