Source for file ex5.php

Documentation is available at ex5.php

  1. <?php
  2.  
  3. /**
  4. * example 5
  5. * demonstrates nullstrings
  6. *
  7. * $Id: fsource_XTemplate__ex5.php.html,v 1.3 2005/04/11 10:00:49 cocomp Exp $
  8. */
  9.  
  10. include_once('./xtemplate.class.php');
  11.  
  12. $xtpl = new XTemplate('ex5.xtpl');
  13.  
  14. $xtpl->assign('INTRO_TEXT', "by default, if some variables weren't assigned a value, they simply disappear from the parsed html:");
  15. $xtpl->parse('main.form');
  16.  
  17. $xtpl->assign('INTRO_TEXT', "ok, now let's assign a nullstring:");
  18. $xtpl->SetNullString('value not specified!');
  19. $xtpl->parse('main.form');
  20.  
  21. $xtpl->assign('INTRO_TEXT', 'custom nullstring for a specific variable and default nullstring mixed:');
  22. $xtpl->SetNullString('no value..');
  23. $xtpl->SetNullString('no email specified!', 'EMAIL');
  24. $xtpl->parse('main.form');
  25. $xtpl->assign('INTRO_TEXT', 'custom nullstring for every variable:) .. you should get it by now. :P');
  26. $xtpl->SetNullString('no email specified', 'EMAIL');
  27. $xtpl->SetNullString('no name specified', 'FULLNAME');
  28. $xtpl->SetNullString('no income?', 'INCOME');
  29. $xtpl->parse('main.form');
  30.  
  31. $xtpl->parse('main');
  32. $xtpl->out('main');
  33.  
  34. /*
  35. $Log: fsource_XTemplate__ex5.php.html,v $
  36. Revision 1.3 2005/04/11 10:00:49 cocomp
  37. Added restart() method sf:641407 feature request
  38. Revision 1.2 2005/04/07 12:02:52 cocomp
  39. MAJOR UPDATE: E_ALL safe, better internal documentation, code readability ++, many bugfixes and new features - considered stable
  40. Revision 1.1 2001/07/11 10:49:25 cranx
  41. *** empty log message ***
  42. Revision 1.2 2001/03/26 23:25:02 cranx
  43. added keyword expansion to be more clear
  44. */
  45.  
  46. ?>

Documentation generated on Mon, 11 Apr 2005 10:59:09 +0100 by phpDocumentor 1.3.0RC3