<?php // extras are loadeds since extras folder. _::declare_extra('funciones'); // this function is execute automatically when this file is load _::define_autocall(function () { // require a model // ATENTION: SINCE 1.0.1 VERSION, THIS IS NOT NECESSARY, USE AUTOLOAD, BUT THIS WORK ANYWAY FOR BACKWARD COMPATIBILITY _::declare_model('usuarios'); // declare other model: _::declare_model('planes'); // call user defined function. basic_headers(); }); // this define a controller home // is called by url param, you see index.php for more info. _::define_controller('home', function () { // checkLogin is user defined function. // _::redirect is a framework function to make a internal redirection (without header(location)) // the first param is the name of te controller to be called. // you able to add second param to force redirect using header('LOCATION ');, but in this case, you need use url in the first param. if (!checkLogin()) { _::redirect('login'); return false; } // this call to function show of the TPL manager, in this case using the default template manager // and like include index.tpl _::$view->show('index'); }); // define a login controller (for example). _::define_controller('login', function () {
<?php // First I declare extra functions: _::declare_extra('functions'); // this load /extras/functions.php /** * Now I need execute some lines of code, ever! * then I define autocall function, this function is it called in the definition * that is to say this function called always when example.php id loaded */ _::define_autocall(function () { execute_one_function(); // this is a example function }); /** * in this time, I define a controller: * I can define one or more controllers in one file. * We recommends depending of case, if you need low cost application (talking about resources), you define one controller per file * If you need sort the code, you can define more controllers in one file. */ _::define_controller('example', function () { // my code here... }); // define other controller // in this controller is exampled the use of models _::define_controller('example_2', function () { // my code here... // declare need model example // this is not necessary since version 1.0.1 _::declare_model('example'); // making new record void