Md. Golam Rabbany

Just work with honesty, Success will come on your door

How to add your Class at CodeIgniter


Step#1: create your own class
<?
class class_name {

function function_name()
{
echo “I am There”;
}

}
?>

Now save this file on your libraries (system->libraries) and file name is must according to your class name like class_name.php

 

Step#2: create a controller like this…
<?php

class own_controller extends Controller {

function own_controller()

{

parent::Controller();

}

function show_text()

{
$this->load->library(class_name);
echo $this-> class_name -> function_name();
}

}
?>

Now save the controller at your controller folder.

OUT PUT will be “I am There”

 

Advertisements

One response to “How to add your Class at CodeIgniter

  1. Shaikh Sonny Aman April 21, 2008 at 5:42 am

    Cool, very handy post for nay newcomer to CI.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: