[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/savant2/Savant2/tests/ -> 3_fetch.php (source)

   1  <?php
   2  
   3  /**
   4  * 
   5  * Tests fetch() issues
   6  *
   7  * @version $Id: 3_fetch.php 18360 2005-05-26 19:38:09Z mipmip $
   8  * 
   9  */
  10  
  11  error_reporting(E_ALL);
  12  
  13  require_once 'Savant2.php';
  14  
  15  $conf = array(
  16      'template_path' => 'templates',
  17      'resource_path' => 'resources'
  18  );
  19  
  20  $savant =& new Savant2($conf);
  21  
  22  $array = array(
  23      'key0' => 'val0',
  24      'key1' => 'val1',
  25      'key2' => 'val2',
  26  );
  27  
  28  $var1 = 'variable1';
  29  $var2 = 'variable2';
  30  $var3 = 'variable3';
  31  
  32  $ref1 = 'reference1';
  33  $ref2 = 'reference2';
  34  $ref3 = 'reference3';
  35  
  36  // assign vars
  37  $savant->assign($var1, $var1);
  38  $savant->assign($var2, $var2);
  39  $savant->assign($var3, $var3);
  40  
  41  // assigns $array to a variable $set
  42  $savant->assign('set', $array);
  43  
  44  // assigns the keys and values of array
  45  $savant->assign($array);
  46  
  47  // assign references
  48  $savant->assignRef($ref1, $ref1);
  49  $savant->assignRef($ref2, $ref2);
  50  $savant->assignRef($ref3, $ref3);
  51  
  52  
  53  echo "<h1>Fetch non-existent template</h1>";
  54  $result = $savant->fetch('no_such_template.tpl.php');
  55  echo "result: <pre>";
  56  print_r($result);
  57  echo "</pre>";
  58  
  59  echo "<h1>Storage</h1>";
  60  echo "properties: <pre>";
  61  print_r(get_object_vars($savant));
  62  echo "</pre>";
  63  
  64  echo "<h1>Fetch existing template</h1>";
  65  $result = $savant->fetch('test.tpl.php');
  66  echo "fetched this code: <pre>";
  67  print_r(htmlentities($result));
  68  echo "</pre>";
  69  
  70  
  71  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7