Controllers
Controllers are responsible for general business logic and the presentation of views. To add one, create a subclass of Core\Controller under /application – in the namespace that corresponds with its path. It must have a filename equal to the lowercase classname, and preferably be placed in a subdirectory equal to the lowercase classname.
For example, a controller at /application/about/about.php would start off with the following code:
<?php
namespace Application\About;
class About extends \Core\Controller
{
public function index()
{
// Content for about page
}
}
Default routing
Any public non-static method is publicly accessible via GET request. The URL at which it can be accessed is /controllername/methodname. For applications with more than one language, the URL is /language/controllername/methodname. Requesting said URL without the method name will call the controller's index method, if available.
If a method returns false, Saturn will continue routing, and display a 404 if no other methods are registered to handle the URL.