[ 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/ -> 6_paths.php (source)

   1  <?php
   2  
   3  /**
   4  * 
   5  * Tests multiple-path directory searches
   6  *
   7  * @version $Id: 6_paths.php 18360 2005-05-26 19:38:09Z mipmip $
   8  * 
   9  */
  10  
  11  function preprint($val)
  12  {
  13      echo "<pre>\n";
  14      print_r($val);
  15      echo "</pre>\n";
  16  }
  17  
  18  error_reporting(E_ALL);
  19  
  20  require_once 'Savant2.php';
  21  
  22  $conf = array(
  23      'template_path' => 'templates',
  24      'resource_path' => 'resources'
  25  );
  26  
  27  $savant =& new Savant2($conf);
  28  
  29  echo "<h1>Paths to begin with</h1>\n";
  30  preprint($savant->getPath('resource'));
  31  preprint($savant->getPath('template'));
  32  
  33  echo "<h1>Add a path</h1>\n";
  34  $savant->addPath('resource', 'no/such/path');
  35  preprint($savant->getPath('resource'));
  36  
  37  echo "<h1>Find an existing resource (non-default)</h1>\n";
  38  $file = $savant->findFile('resource', 'Savant2_Plugin_cycle.php');
  39  preprint($file);
  40  
  41  echo "<h1>Find an existing resource (default)</h1>\n";
  42  $file = $savant->findFile('resource', 'Savant2_Plugin_input.php');
  43  preprint($file);
  44  
  45  echo "<h1>Find a non-existent template</h1>\n";
  46  $file = $savant->findFile('template', 'no_such_template.tpl.php');
  47  if ($file) {
  48      preprint($file);
  49  } else {
  50      preprint("false or null");
  51  }
  52  ?>


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