Class home or home.php file is the default access controller from each URI even in the sub directory.
Controller Class
Controller is the main actor in Seme Framework life cycle.
A Controller is simply a class file that is named in a way that can be associated with an URI.
The controller class relatives to app/controller
directory.
The controller filename and class name can only have alphanumeric with underscore.
Example
Here is the basic example for a controller structure:
app |-- controller |---- home.php |---- blog.php
Lets say, you have extracted Seme Framework on D:\XAMPP\htdocs\seme-framework
So, if you accessing the http://localhost/seme-framework
the Seme Framework will load home.php
controller.
How if, we accessing http://localhost/seme-framework/blog
?
The answer is, Seme Framework will load controller blog.php
Seme Framework will only load controller with filename and its class name are matched.
SENE_Controller
SENE_Controller is basic class for creating controller which contain properties and methods that are required for using Seme Framework properly.
Basic Usage
Here is some basic usage for creating controller
Default Controller
Here is the default source code of controller.
<?php class Home extends Sene_Controller{ public function __construct(){ parent::__construct(); } public function index(){ echo 'Thankyou for using Seme Framewrok'; } }
Notfound Controller
Here is the default source code of notfound controller.
<?php class Notfound extends Sene_Controller{ public function __construct(){ parent::__construct(); } public function index(){ header("HTTP/1.0 404 Not Found"); echo '404 Notfound'; } }
Access Methods
Seme Framework supported access method for public and private declaration.
Private Properties and Methods
Seme Framework allow your method in Private or in Protected mode. The Private or Protected mode cant be executed through URI request. Or you can use double underscore (__) means as Private properties or methods.
class Home extends Sene_Controller{ var $public_var = 'Yi-Ha!'; var $__underWear = 'My Private Things'; public function __construct(){ parent::__construct(); } private function __processFile(){ return true; } public function index(){ echo '404 Notfound'; } }