Source for file ex5.php

Documentation is available at ex5.php

  1. <?php
  2.  
  3. /**
  4. * example 5
  5. * demonstrates nullstrings
  6. *
  7. * @package XTemplate_Examples
  8. * @author Barnabas Debreceni [cranx@users.sourceforge.net]
  9. * @copyright Barnabas Debreceni 2000-2001
  10. * @author Jeremy Coates [cocomp@users.sourceforge.net]
  11. * @copyright Jeremy Coates 2002-2007
  12. * @see license.txt LGPL / BSD license
  13. * @link $HeadURL: https://xtpl.svn.sourceforge.net/svnroot/xtpl/trunk/ex5.php $
  14. * @version $Id: ex5.php 16 2007-01-11 03:02:49Z cocomp $
  15. */
  16.  
  17. include_once('./xtemplate.class.php');
  18.  
  19. $xtpl = new XTemplate('ex5.xtpl');
  20.  
  21. $xtpl->assign('INTRO_TEXT', "by default, if some variables weren't assigned a value, they simply disappear from the parsed html:");
  22. $xtpl->parse('main.form');
  23.  
  24. $xtpl->assign('INTRO_TEXT', "ok, now let's assign a nullstring:");
  25. $xtpl->set_null_string('value not specified!');
  26. $xtpl->parse('main.form');
  27.  
  28. $xtpl->assign('INTRO_TEXT', 'custom nullstring for a specific variable and default nullstring mixed:');
  29. $xtpl->set_null_string('no value..');
  30. $xtpl->set_null_string('no email specified!', 'EMAIL');
  31. $xtpl->parse('main.form');
  32.  
  33. $xtpl->assign('INTRO_TEXT', 'custom nullstring for every variable:) .. you should get it by now. :P');
  34. $xtpl->set_null_string('no email specified', 'EMAIL');
  35. $xtpl->set_null_string('no name specified', 'FULLNAME');
  36. $xtpl->set_null_string('no income?', 'INCOME');
  37. $xtpl->parse('main.form');
  38.  
  39. $xtpl->parse('main');
  40. $xtpl->out('main');
  41.  
  42. ?>

Documentation generated on Tue, 29 May 2007 19:29:34 +0100 by phpDocumentor 1.3.0RC3