*/ /** * Illustrates the use of the dispatcher * * @package Tina-MVC * @subpackage Tina-Sample-Apps */ class dispatcher_example_page extends tina_mvc_base_page_class { /** * Check the request and call the appropriate class method * * @param array $request extracted from $_GET - /controller/action/some/data */ function __construct( $request ) { // permission override - this controller should be accessible to all... $this->role_to_view = FALSE; parent::__construct( $request ); /** * This is what enables the dispatcher function. Your method will be called AFTER * permissions checks have been completed. */ $this->use_dispatcher = TRUE; } /** * Default controller */ function index() { $this->set_post_title('Hello from the \''.__FUNCTION__.'\' method!'); $this->set_post_content( $this->_some_blurb() ); } /** * Another controller */ function another_controller() { $this->set_post_title('Hello from the \''.__FUNCTION__.'\' method!'); $this->set_post_content( $this->_some_blurb() ); } /** * Yet another controller */ function yet_another_controller() { $this->set_post_title('Hello from the \''.__FUNCTION__.'\' method!'); $this->set_post_content( $this->_some_blurb() ); } /** * Some blurb * * You will note it is private to prevent it from being called in response to a * request. Name it with a leading underscore to prevent the dispatcher from executing * it. Follow this example */ private function _some_blurb() { return 'It Worked! (at '.tina_mvc_db_datetime().')'. '