Directory Structure:
================================
EventTest.php
|--bin
|--templates
|--EventTest.tmpl.php
EventTest.php (CodeBehind Page)
================================
<?php
class pageEventTest extends page {
var $layout = "Columns1";
/* AREA 2 - Center Page */
function area2(){
$this->title = "Event Test Example";
$this->border = 1;
return $this->fetch("EventTest.tmpl.php");
}
/* EVENT - Signs up user to mailing list */
function eventSignupEmail(){
//get the email address
$email = util::getData("email"); //Same as $mail = $_POST["email"]
//perform some actions here, such as saving the email
//to the database
}
}
?>
EventTest.tmpl.php (Template)
================================
Signup for our mailing list!
<form action="<?=$PHP_SELF?>" method="post">
<input type="hidden" name="event" value="SignupEmail">
Email: <input type="text" name="email">
<input type="submit" value="Signup!">
</form>

Use the built in $this->setEventResult($bool, $text); function
Set a value to a member variable of your class, such as $this->myResult = true;
EventTest.php (CodeBehind Page)
================================
<?php
class pageEventTest extends page {
var $layout = "Columns1";
/* AREA 2 - Center Page */
function area2(){
$this->title = "Event Test Example";
$this->border = 1;
//Member variable event result - pass to template
$this->set("firstEmailDate",$this->firstEmailDate);
return $this->fetch("EventTest.tmpl.php");
}
/* EVENT - Signs up user to mailing list */
function eventSignupEmail(){
//get the email address
$email = util::getData("email"); //Same as $mail = $_POST["email"]
//perform some actions here, such as saving the email
//to the database
//Set event result:
//Regular way:
$this->setEventResult(true, "Welcome to the Mailing List!");
//Using a member variable to carry data:
$this->firstEmailDate = "March 5th";
}
}
?>
EventTest.tmpl.php (Template)
================================
<?php if(isset($eventResult)){ ?>
Welcome to the mailing list! Your first email should arrive on <b><?=$firstEmailDate?></b>.
<?php } else { ?>
Signup for our mailing list!
<form action="<?=$PHP_SELF?>" method="post">
<input type="hidden" name="event" value="SignupEmail">
Email: <input type="text" name="email">
<input type="submit" value="Signup!">
</form>
<?php } ?>
