Controllers

Creating Controllers

When creating controller in e-mvc, you need to create our controller name as nameController.php

Page Redirect

We perform the process of calling the desired law from the controller with the view or page methods that we inherit from the mainController.

Layout Routing

If we want to call the page in the layout we created, $this->view('pagename'); We can call our page. This page that we call will be published in the template we have previously determined.

<?php 

use Controller\Main\mainController;

class defaultController extends mainController{

    public function index(){
        $this->view("pagename");
    }

}

Simple Routing

If we only want to call a special page, we can call our page with the page method. This called page will be called without being included in any template.

<?php 

use Controller\Main\mainController;

class defaultController extends mainController{

    public function index(){
        $this->page("pagename");
    }

}

Getting Parameters

We can easily import the values ​​we receive as variables on the URL into the controller. We can process the value from the user on our page or on our Model by sending the $e variable in the method we have determined.

<?php 

use Controller\Main\mainController;

class defaultController extends mainController{

    public function index($e){
        $this->view("default",$e);
    }

}