PHP

Smart Tags | Page Variables | Session Variables | Snippets | PHP | Language Variables (Constants) | SQLITE | GET variables | Templates Markup

 PHP Description Result

PHP can be added to your top.inc, header.php, footer.php and foot.inc files. (Put snippets in your top.inc file.)

These examples show you how you can add your own php code. This first example provides the correct phone prefix depending on the users country.

Phone us on: <?
if($_SESSION[country_id]=='121') print '(09)'; else print '0064 9';
?>
555 2458

Phone us on: 0064 9 555 2458

In this example someone has linked to your website with an incorrect or obsolete URL: www.yourwebsite.co.nz/homepage.html

While there are other ways you can set redirects, you can edit the top.inc file and set up a redirect:

<?
if($_SERVER[REQUEST_URI]=='/homepage.html') {
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: /" );
exit;
}
?>

For all PHP files go to /vendo/php/

The page will redirect user to the homepage.

Load order for PHP files

PHP files are included and loaded in the following order (your files are in bold):

  1. System global
  2. head.inc can also be named top.inc
  3. System header including <html> <head> and <body> tags
  4. header.html your template header
  5. header.php
  6. System page content beginning with h1 tag
  7. footer.php
  8. footer.html your template footer
  9. System footer including closing html </body> and </html> tags
  10. foot.inc can also be named bottom.inc