NetworkClue.com
NetworkClue Home PageHome Contact UsContact ConsultingConsult
Bulletin Board
Internet Services covers Secrets to hosting websites, Hosting your own web server, and using DNS Servers.Operating Systems leads you through the decision of Linux vs. Windows, ideal installations and setups to create an efficient and redundant environment for your business, and great features to make management easier.Routing & Firewalls contains articles that will allow you to take control of your router. Learn how to protect your company with access lists and advanced firewall techniques.Hardware answers the common questions about Switches vs. Hubs, recommends SysAdmin Tools, and recommendations for adequate power protection.Utilities will cover fighting spam, using Anti-Virus programs effectively and the must haves for every administrator's software toolbox.

Bulletin Board

Handy PHP

PHP Includes:

PHP includes are a bit tricky. They can be an absolute path from the root of the server (not the website) or relative from the page where the include is being called.

How I like to keep track of includes is by using a PHP function called $_SERVER["DOCUMENT_ROOT"]. This will then provide the complete physical path of the site and I can then append the location of the icnlude page from the root of the site.

<?php include( $_SERVER["DOCUMENT_ROOT"] . "'/includes/include_page.php"); ?>

IF statements:

<?php
'Set the variable
Happy=1;

If Happy=1 {
?>
   <p>I am really happy</p>
<?php }
Else {
?>
   <p>I am not happy at all</p>
<?php
}
?>

Random Numbers

Random numbers are simple. Just by using call the rand function and send it two integers, the first integer being the smallest random value and the last integer being the largest.

variable=rand (first integer,last integer);

Switch

switch (variable) {
case 1: print "the value of variable is 1";
 break;
case 2: print "the value of variable is 2";
 break;
case 3: print "the value of variable is 3";
 break;
   :
case N: print "the value of variable is N";
 break;

default: print "invalid number;"
 break;

Article last reviewed: 08/31/2003


del.icio.us

Created by: Digital Foundation, inc.

Copyright © 2002-2005 Digital Foundation, inc.   www.networkclue.com

All content of the NetworkClue website is copyrighted. Articles, notes, outlines, and all other materials may not be stored on the Internet or sold or placed by themselves or with other material in any electronic or printed format in whole or part. However materials may be referenced by links to the site.

 

Related Articles:
Handy HTML
Website Best Practices