XiTemplate Home Page XiTemplate
[ class tree: XiTemplate ] [ index: XiTemplate ] [ all elements ]

Example usage of rparse()

  1. <?php
  2. /*include the class*/
  3. include_once('../class.XiTemplate.php');
  4.  
  5. /*instantiate the class and pass the path to your html template file*/
  6. $xitpl = new XiTemplate('templates/rparse.tpl');
  7.  
  8. /*assign a value to a template variable.*\
  9. /*In this example {NAME} will be replaced with "XiTemplate"*/
  10. $xitpl->assign('NAME', 'XiTemplate');
  11.  
  12. /*this variable exists in subBlock1*/
  13. $xitpl->assign('SUB1', 'sub block 1');
  14.  
  15. /*this variable exists in subBlock2*/
  16. $xitpl->assign('SUB2', 'sub block 2');
  17.  
  18. /*this variable exists in subBlock3*/
  19. $xitpl->assign('SUB3', 'sub block 3');
  20.  
  21. /*only parsing subBlock3*/
  22. $xitpl->parse('main.subBlock3');
  23.  
  24. /*recursively parse the "main" block of the template (the whole page)...*/
  25. /*and all sub blocks within "main".*/
  26. /*This will parse subBlock1, subBlock2, and subBlock3 regardless of whether */
  27. /*they have parsed before or not*/
  28. $xitpl->rparse('main');
  29.  
  30. /*send the final page out to the browser*/
  31. $xitpl->out('main');
  32. ?>

Documentation generated on Fri, 20 Aug 2004 10:57:45 -0500 by phpDocumentor 1.3.0RC3