Compiled Home Pages




Simple web page example:

<!DOCTYPE html>
<html><head><title>Simple web page example</title></head>
<body>5 + 3 = <?chp echo(5+3); ?></body></html>
<?chp
public:
using php;
?>

Add a function on the page:

<!DOCTYPE html>
<html><head><title>Add a function on the page</title></head>
<body>5 + 3 = <?chp AddTwoNumbers(5,3); ?></body>
<?chp
public:
using php;
void AddTwoNumbers(int $a,int $b) {
  // $ is put before variable names to be like PHP.
  // You don't have to do that. But it makes it easier for PHP programmers to understand.
  echo($a + $b);
} ?>

Calling a function on another page:

<!DOCTYPE html>
<html><head><title>Calling a function on another page</title></head>
<body>5 + 3 = <?chp
auto $other_page = OtherPage::Create(Context);
// You can also call another page's Render() method to simulate the require method of php.
$other_page->AddTwoNumbers(5,3);
$other_page->Dispose();
// You can also call static methods on other pages without creating an instance of that class.
// But if you do that, that instance can't call echo because there's no Context.
?></body></html>
<?chp
public:
using php;
include "OtherPage.h";
?>