Item management: PHP items
|
|||
|
Item management: PHP items
PHP items are pieces of PHP code which are executed once using PHP's eval() function when the item is processed by build.php. Any static content must be contained within ?> and <? just as it would be in a normal PHP file. Just as with any PHP script, all GET or POST variables are available as PHP variables, allowing you easy access to your form output. Sadly though it is impossible to extend PHP conditionals, loops or other control structures between TT Web Site Manager items so all such code constructs must be terminated within a single item. The form for a simple PHP item is shown below.
About the PHP environemnt in the TT Web Site Manager.
The TT Web Site Manager runs the code supplied to it from a PHP item using PHP's eval() function.
Thus almost any valid PHP code can be placed in a PHP item and it will run as if it were part of
a PHP file. However, since the PHP items are being run along with whatever other items you have
in your pages by build.php you can not use PHP constructs than run over more than one TT Web Site
Manager PHP item.
In addition, a PHP return statement will terminate the piece of code being run by the eval() function. Historicaly, PHP made available all HTTP GET or POST variables passed to a script by name within the script. Thus the script http://hostname/script.php?surname=Jones would have available within it a variable called $surname, in this case set to "Jones". PHP version 4 allowed this behaviour to be turned off for security reasons with a configuration flag called register_globals, from PHP version 4.2 this was turned off by default. The TT Web Site Manager makes these varables available to PHP items as if register_globals was not turned off. It is possible that future versions of the TT Web Site Manager will allow this to be turned on or off. All the internal variables used by the TT Web Site Manager scripts have names prefixed by "tt_", for instance $tt_site or $tt_page. For this reason it is requested that you do not use this naming convention for any of your variables. Build.php makes available a variable called $tt_counter which contains the number of times the current page has been accessed. This can be used to provide a hit counter in conjunction with a PHP item that sends it to the browser.
|
|||
|