* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Controllers; use TheTempusProject\Classes\Controller; use TheTempusProject\Houdini\Classes\Template; use TheTempusProject\Houdini\Classes\Views; use TheTempusProject\Canary\Bin\Canary as Debug; // The new controller must extend the default controller class or some functionality will be lost. class Example extends Controller { /** * A constructor does not have to be defined. * If a constructor is used, it must call the parent constructor first. */ public function __construct() { parent::__construct(); Template::noFollow(); Template::noIndex(); Template::setTemplate( 'example' ); } /** * A destructor does not have to be defined. * If a destructor is used, it must call the parent destructor last. */ public function __destruct() { Debug::log( 'Something to log before the app ends execution.' ); parent::__destruct(); } public function index() { self::$title = 'Example Controller'; Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] ); Issues::add( 'error', 'This is a single error.' ); Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] ); Issues::add( 'success', 'This is a single success.' ); Issues::add( 'notice', 'This is a single notice.' ); Issues::add( 'info', 'This is a single info.' ); Components::set( 'simple', Views::simpleView( 'simple' ) ); Components::set( 'complex', Views::simpleView( 'complex' ) ); Views::view( 'example' ); $example = Views::simpleView( 'example' ); } }