My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Controller  
Controller Sample
Phase-Implementation
Updated Aug 11, 2009 by felice.ostuni

Controller Sample

A controller is a simple php class it must extend rpd superclass (so it can inherit $this->db, $this->url and some other system libraries).

Conventions/rules:

  • Class name must end with controller
  • Filename must be minuscase, with the same class name (without controller suffix)
  • File must be deployed in /application/controllers/ (or in /modules/modulename/controllers/)
<?php

class welcome_controller extends rpd {

  function index()
  {
    $vars = array('varname'=>'value');
    echo $this->view('welcome',$vars);
  }
  
  function test()
  {
    echo 'test';
  }

}

this request:

http://website/welcome

will parse the View 'welcome' then the result will be printed

this other request:

http://website/welcome/test

will output 'test'


Sign in to add a comment
Powered by Google Project Hosting