Structure | Controller

Controllers accept control of a request (from the browser) from the application. The Application operates at the root of the web structure and interprets the request to instatiate a controller request and execute a method of the controller

Browser Request

http://localhost/example/hello

Controller

<?php
class example extends Controller {
    function hello() {
        print 'hello';

    }

}

Up to two parameters can be passed

Browser Request

http://localhost/example/hello/john/citizen

Controller

<?php
class example extends Controller {
    function hello( $p1, $p2) {
        printf( 'hello : %s, %s', $p1, $p2;

    }

}

See Also

Caveats

  • it's quite simple - function names support upper, lower case and underscore but not too much else
  • parameter passing is parsed through php filters : $url = filter_var( $this->url, FILTER_SANITIZE_URL);, so again it has to be fairly simple - periods [.] for instance are stripped out. POST and GET via parameters (http://req/?v=1) are the most flexible ways to pass information.