partTime.php
-----------------
<?php
class partTime extends part {
//the view that should be shown by default
var $defaultView = "Time";
/* View Handler - Shows Time*/
function viewTime(){
//get the current time
$time = date("g:i a");
//pass it to the template
$this->set("time",$time);
//render
return $this->fetch("time.tmpl.php");
}
/* View Handler - Shows Date*/
function viewDate(){
//get date
$date = date("F j, Y");
//pass it to the template
$this->set("date",$date);
//render
return $this->fetch("date.tmpl.php");
}
} ?>
time.tmpl.php
-----------------
The current time is <b><?=$time?></b>!
<br />
<a href="<?=$PHP_SELF?>?v<?=$id?>=date">Show Date</a>
date.tmpl.php
-----------------
The current date is <b><?=$date?></b>!
<br />
<a href="<?=$PHP_SELF?>?v<?=$id?>=time">Show Time</a>


<a href="<?=$PHP_SELF?>?v<?=$id?>=date">Show Date</a>
Part View Handlers can not control where on the page they are rendered (no area1, area2, etc.). This is because a user will be dragging and dropping a part to one of these areas on their own.
Part View Handlers can not be stacked to render multiple sections within the same area. (no area1_1, area1_2, etc.)
Part View Handlers are selected based on the value of the $vID variable in the query string (where ID is the id of the part, which can be access by $this->id within the part, or $id from within a template.)