PHP Classes

File: Controller/welcome.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Aziz S. Hussain  >  Aziz MVC  >  Controller/welcome.php  >  Download  
File: Controller/welcome.php
Role: Class source
Content type: text/plain
Description: Sample Controller
Class: Aziz MVC
Framework that uses MVC design pattern
Author: By
Last change: Fixed Minor Bugs
Date: 4 years ago
Size: 1,394 bytes


Class file image Download
if(!defined('BASEPATH')){ die();}


AzizMVC By Aziz S. Hussain
Licensed under LGPL

File Name: welcome.php

This is an example of how you would create a controller.

--> Basically all controllers must extend the mainController
--> Your constructor must initialize the parent constructor as well
--> Index function will always get called if it exists
--> If you access the controller through this: /index.php/welcome/test,
    it will try to execute the test() function in the class


class welcome extends mainController
// load controller
public function __construct()
// Initialize parent
// index page
function index()
        // Load model (model filename, handler)
        // Execute the model test function (basically echos 'test' for now)
        // Custom data to pass to viewer
$data['testVar'] = ' > Test 123';
// Load viewer and save it to use on the template plugin
$page = $this->loadViewer('welcome',$data,true);
$templateInfo = array('header', 'footer', 'links');
// Echo page + template (using auto loaded template plugin)
echo showTemplate($page,$templateInfo,'Default',$data);

// End of file /AzizMVC/Controller/welcome.php