PHP Classes

File: docs/anm_ci_example.php

Recommend this page to a friend!
  Classes of A.N.M. Saiful Islam   ANM_CI   docs/anm_ci_example.php   Download  
File: docs/anm_ci_example.php
Role: Example script
Content type: text/plain
Description: An example controller implementing all the properties and methods of ANM_CI
Class: ANM_CI
Remap method and redirect request with CodeIgniter
Author: By
Last change:
Date: 15 years ago
Size: 1,072 bytes
 

Contents

Class file image Download
<?php
class ANM_CI_Example extends Controller
{
   
/*
     * Class constructor
     */
   
function __construct()
    {
       
parent :: Controller();
       
$this->load->library( 'anm_class/anm_ci' );
    }


   
/*
     * URI remap
     */
   
function _remap( $method )
    {
       
$rules = array(
           
'index' => 'index',
           
'login' => 'user_login',
           
'not-found' => 'page_not_found'
       
);

       
$this->anm_ci->remap( $method, $rules, 'not-found' );
    }


   
/*
     * Controller's default page
     *
     * URI: {base_url}/anm_ci_example
     */
   
function index()
    {
       
$this->anm_ci->redirect( 'anm_ci_example/login' );
    }


   
/*
     * User's login page
     *
     * URI: {base_url}/anm_ci_example/login
     */
   
function user_login()
    {
        echo
'Example Login';
    }


   
/*
     * If requested page is not available
     *
     * URI: {base_url}/anm_ci_example/not-found
     */
   
function page_not_found()
    {
        echo
'Page Not Found';
    }
}