Hello From Model

On this tutorial we will learn, how to interacted with model from controller.

First, open files located at app/model/hello_model.php.

If the file doesnt exists, create one.

And then, put this code on it.

<?php
class Hello_Model extends SENE_Model
{
  public function __construct()
  {
    parent::__construct();
  }
  public function get()
  {
    return 'Hello World, from model';
  }
}

And then, open and edit the app/controller/home.php again.

Put model loader on constructor.

<?php
class Home extends SENE_Controller
{
  public function __construct()
  {
    parent::__construct();
    $this->load("hello_model", "h");
  }
  public function index()
  {
    echo $this->h->get();
  }
}

And then open http://localhost/seme_framework, it should show Hello World from model.