NetCloak provides web-masters with a simple yet powerful set of commands for creating dynamic websites. Maxum developed NetCloak for use with servers running on the MacOS.
NetCloak commands are embedded into HTML documents with a syntax similar to HTML tags. When an HTML document is requested from a web server running NetCloak, the server allows NetCloak to review the file before sending it to the requestor. NetCloak executes the commands and creates a fresh dynamic HTML document. The server sends the new document to the requestor.
An example: <INSERT_TIME> would print the current time: 1:24:54 PM.
PHP is a freely distributed server-side parsing engine with an extremely powerful yet complex set of commands. PHP syntax is similar to C and Perl but it is embedded into HTML documents. When a PHP document is requested, the server sends the document through the PHP engine to execute the commands before returning the dynamic content.
Say you have a PHP file "add.php" which contains:
<FONT size="+2">
<?php
$a = 2;
$b = 2;
echo "$a + $b = " . ($a + $b);
?>
</FONT>
When the file is requested, since the extension is .php, the server sends it through the PHP4 Hypertext Preprocessor. (For PHP3, the .php3 extension should be used.) The preprocessor parses the code inside the PHP tags and returns an HTML document. The resulting HTML document for this example looks like this:
<FONT size="+2"> 2 + 2 = 4 </FONT>
| Operator | Meaning | Example: true | Example: false |
== | equals | 1 == 1 | 1 == 2 |
!= | unequal to | 1 != 2 | 1 != 1 |
< | less than | 1 < 2 | 1 < 1 |
<= | less than or equal to | 1 <= 1 | 2 <= 1 |
> | greater than | 2 > 1 | 1 > 1 |
>= | greater than or equal to | 1 >= 1 | 1 >= 2 |
if, else if, else Commandif can be appended with the else if and
else commands.
<?php
if( boolean_expression )
{
statement_1;
statement_2;
...
}
else if( boolean_expression )
{
...
}
else if( boolean_expression )
{
...
}
...
else
{
...
}
?>
You may have as many else if statements as you would like,
but there is exactly one if and at most one else.
Within the curly brackets, you may have as many statements as you require.
Without curly brackets, you may have exactly one statement:
<?php
if( boolean_expression )
statement;
else if( boolean_expression )
statement;
else
{
statement_1;
statement_2;
...
}
?>
There is also an Alternative Sytnax for Control Structures. The rest of this documentation will use the syntax described above. If you're curious, take a look at some of the other Control Structures defined in PHP.
if Statementif statement lets you specify PHP commands
based on a boolean expression. If you have HTML that you want to display based on that
expression you could use the echo command. But if you have a large amount
of HTML, you wouldn't want to use echo, you could just leave the PHP parsing engine:
the HTML would be put directly into the output.
<?php
if( boolean_expression )
{ // Exit the PHP and start displaying HTML.
?>
This HTML is only displayed if <CODE>boolean_expression</CODE> is true.
<?php // Re-Enter the PHP to finish the if statement.
}
?>
Before the first line of PHP, the page is set up for either case: Welcome to the store.
<?php if( Business_Hours ) { ?>
<?phpOpens the PHP. if( Business_Hours ) {Business_Hoursis psuedo code for a boolean expression saying that the current time is during business hours.
Executes a sequence of commands ifBusiness_Hoursis true.
The curly bracket is neccessary since the PHP is being closed.?>Closes the PHP.
The HTML that follows is only written if theifstatement succeeded.
<?php } else { ?>
<?phpReopens the PHP. }Closes the ifstatement.else {Executes a sequence of commands if the ifstatement failed.?>Closes the PHP.
The HTML that follows is only written ifBusiness_Hourswas false.
<?php } ?>
<?phpReopens the PHP. }Closes the elsestatement.?>Closes the PHP.
The HTML that follows is always written.
The functionality of NetCloak is not built into PHP. To give PHP the NetCloak behavior, special functions have been defined in these files:
NetCloak.inc contains every function.
If you only need to use certian topics of NetCloak, include the following.
NetCloak commands rely on commands such as <SHOW> and <HIDE> to determine which information a page will display.
PHP uses the C/Perl style if command to determine such information.
In Net Cloak you would use <HIDE><SHOW_CLIENT "Mac">to show this text to Mac users and <SHOW>to show this text to everyone.
In PHP, if the function ClientType.inc is included then <?php if( ShowClient("Mac") ) { ?> this text will be shown to Mac users an ><?php } ?> this text will be shown to everyone.
The functionality described in this manual can be included into php file with PHP's include() function:
<HTML>
<HEAD>
<TITLE>My PHP Page.php</TITLE>
<?php include("Netcloak.inc"); ?>
</HEAD>
<BODY>
...
</BODY>
</HTML>
Click to get NetCloak.inc.
If you prefer, you can get the files split into the NetCloak Sections.
Example: <?php echo "The echo construct prints this string that follows." ?>RequiredFunction()
<?php //---------------- // Information //---------------- function definition; ?>