-
Notifications
You must be signed in to change notification settings - Fork 2
Pages and Recognizers
splitice edited this page May 3, 2012
·
1 revision
A page recognizer is a class that routes requests to the appropriate PageHandler. Page Recognizers must implement the Web\PageRecogniser\IPageRecognise
interface. To make creation of Recognizers faster a few abstract templates have been provided to allow routing based on simple rules. An example of the Standard Template is below.
class Listings extends Templates\Standard {
static $match = array(
'/archive/%(month)d/%(year)d'=>'\\Web\\Pages\\Listing',
'/' => '\\Web\\Pages\\Listing'
);
}
<?php
namespace Web\Pages;
class Listing extends PageHandler\HTMLPageBase {
function __construct($data = array()){
}
function Title($part = null){
return parent::Title('OMG it works');
}
function GET() {
//...
return new ContainerTemplate('index');
}
}