[ 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/ -> 4_plugins.php (source)

   1  <?php
   2  
   3  /**
   4  * 
   5  * Tests default plugins
   6  *
   7  * @version $Id: 4_plugins.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  // load the cycle plugin with preset cycle values
  53  $savant->loadPlugin(
  54      'cycle',
  55      array(
  56          'values' => array(
  57              'lightdark' => array('light', 'dark')
  58          )
  59      )
  60  );
  61  
  62  // preload the image plugin
  63  $savant->loadPlugin('image',
  64      array(
  65          'imageDir' => 'resources/'
  66      )
  67  );
  68  
  69  // preload the dateformat plugin
  70  $savant->loadPlugin('dateformat',
  71      array(
  72          'custom' => array(
  73              'mydate' => '%d/%m/%Y'
  74          )
  75      )
  76  );
  77  
  78  // preload a custom plugin
  79  $savant->loadPlugin('fester', null, true);
  80  
  81  // run through the template
  82  $savant->display('plugins.tpl.php');
  83  
  84  // done!
  85  ?>


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