PHP Classes
elePHPant
Icontem

File: documentation/en/Controllers.md

Recommend this page to a friend!
  Classes of Fernando Val  >  Springy  >  documentation/en/Controllers.md  >  Download  
File: documentation/en/Controllers.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Springy
Microframework for Web application development
Author: By
Last change: Documentation
Date: 1 year ago
Size: 1,201 bytes
 

 

Contents

Class file image Download

Controllers

About

Controller is part of MVC architecture of the framework. All actions is you application is started by a controller class. They are responsible for processing requests and generating responses.

Creating Controllers

To create a controller all you need is put a file named nameofthepage.page.php containing a class named NameOfThePage_Controller inside the controllers directory.

The names of the files must be correspondent to the URL who the user is accessing and it is case sensitive, followed by the suffix .page.php.

If the user is accessing the page /my-first-page then the controller file must have the name my-first-page.page.php to the framework call it.

Your class can extends the Springy\\Controller class.

The follow example show a simple controller code:

use Springy\Controller;

class MyController_Controller extends Controller
{
    public function _default()
    {
        $this->_template();
        $this->template->display();
    }
}