home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / bug-645588.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.3 KB  |  53 lines

  1. <?php
  2. /**
  3.  * Global functions
  4.  *
  5.  * @package   tests
  6.  * @author    Mark van Renswoude
  7.  * @since     26-03-2002 15:56
  8.  * @version   1.0
  9. */
  10.  
  11. /**
  12.  * Set a variable, used by the template engine but available to all scripts
  13.  *
  14.  * globalSetVar sets an internal variable. This variable may later be retrieved using globalGetVar,
  15.  * and is automagically available to templates using the getvar-tag.
  16.  *
  17.  * @param string $name    the name of the variable to set
  18.  * @param string $value   new value
  19.  * @return string         an empty string to simplify the replacement of setvar-tags in the templates
  20.  * @see                   globalGetVar()
  21. */
  22. function globalSetVar($name, $value)
  23. {
  24.   global $variables;
  25.  
  26.   $variables[$name] = $value;
  27.   return '';
  28. }
  29.  
  30. /**
  31.  * Get a variable's value
  32.  *
  33.  * globalGetVar returns the value of an internal variable. This variable must be previously
  34.  * assigned using either globalSetVar, or an indirect setvar-tag in a loaded template.
  35.  * 
  36.  * @param string $name    the name of the variable to return
  37.  * @return string         the variable's value
  38.  * @see                   globalSetVar()
  39. */
  40. function globalGetVar($name)
  41. {
  42.   global $variables;
  43.  
  44.   if (isset($variables[$name]))
  45.   {
  46.     return $variables[$name];
  47.   }
  48.   else
  49.   {
  50.     return '';
  51.   }
  52. }
  53. ?>