HTML_Template_Flexy
[ class tree: HTML_Template_Flexy ] [ index: HTML_Template_Flexy ] [ all elements ]

Source for file Test.php

Documentation is available at Test.php

  1. #!/usr/bin/php
  2. <?php
  3. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2002 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.02 of the PHP license,      |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Authors:  nobody <nobody@localhost>                                  |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: Test.php 142157 2003-10-10 09:27:34Z alan_k $
  21. //
  22. //  This is a temporary file - it includes some of the 
  23. // Code that will have to go in the Engine eventually..
  24. // Used to test parsing and generation.
  25. //
  26.  
  27. //ini_set('include_path', ini_get('include_path').realpath(dirname(__FILE__) . '/../../..'));
  28. require_once 'Gtk/VarDump.php';
  29. require_once 'Console/Getopt.php';
  30. require_once 'HTML/Template/Flexy.php';
  31. require_once 'HTML/Template/Flexy/Compiler.php';
  32.  
  33. // this is the main runable...
  34.  
  35. class HTML_Template_Flexy_Test {
  36.  
  37.  
  38.     function HTML_Template_Flexy_Test ({
  39.         // for testing!
  40.         $GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions'= array(
  41.             'compileDir' => dirname(__FILE__),
  42.             'locale' => 'en',
  43.           
  44.         
  45.         );
  46.             
  47.         $this->parseArgs();
  48.         $this->parse();
  49.         
  50.     }
  51.     
  52.     
  53.     
  54.     function parseArgs({
  55.         // mapp of keys to values..
  56.       
  57.         
  58.         $args = Console_Getopt::ReadPHPArgV();
  59.         $vals = Console_Getopt::getopt($args,'');
  60.         //print_r($vals);
  61.         $files $vals[1];
  62.         
  63.         if (!$files{
  64.             $this->error(0,"No Files supplied");
  65.         }
  66.         
  67.         foreach($files as $file{
  68.             $realpath realpath($file);
  69.             if (!$realpath{
  70.                  $this->error(0,"File $path Does not exist");
  71.             }
  72.             $this->files[$realpath;
  73.         }
  74.         
  75.         
  76.     }
  77.     
  78.     var $files// array of files to compile
  79.     var $quickform;
  80.     
  81.     function parse({
  82.         foreach($this->files as $file{
  83.             $flexy = new HTML_Template_Flexy(array(
  84.                     'compileToString'=>true,  
  85.                     'valid_functions' => 'include'
  86.             ));
  87.             $compiler =  HTML_Template_Flexy_Compiler::factory($flexy->options);
  88.             $result $compiler->compile($flexy,file_get_contents($file));
  89.             echo $result;
  90.             print_r(array_unique($GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['gettextStrings']));
  91.             print_r($flexy->elements);
  92.             
  93.         }
  94.         
  95.         
  96.         
  97.         
  98.         
  99.     }
  100.        
  101.     function error($id,$msg{
  102.         echo "ERROR $id : $msg\n";
  103.         exit(255);
  104.     }
  105.       
  106.     function debug($id,$msg{
  107.         echo "Debug Message ($id) : $msg\n";
  108.     }
  109.     
  110.     
  111. }
  112.  
  113.  
  114.  
  115. new HTML_Template_Flexy_Test;
  116. ?>

Documentation generated on Mon, 11 Mar 2019 15:59:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.