Table of Contents

Getting Started

References

ANM_CI is a PHP class which is developed to use as a CodeIgniter’s user library. This library integrates CodeIgniter with ANM technology which is able to achieve 100% satisfaction of programmers while using CodeIgniter because of its efficiency, simplicity and usefulness. I encourage you to use the library to see that how it makes your life so easy & comfortable.

Description

This is an instance of main CodeIgniter object. It is a public property. So you can use it anywhere where anm_ci library is accessible.

Typically this object is used to load and access CodeIgniter recourses like library, view, model, database, scaffolding, vars, helper, plugin, file, lang, config etc. You can use the above ci object as an alternate of the CodeIgniter’s this object.

Example

$this->anm_ci->ci->load->model('Model_name');

is equivalent of

$this->load->model('Model_name');

Note

You’ll notice that the ci property is being passed by reference. This is very important. Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy of it.

Parameters

method – Typically second segment of the URI

rules – Rules to decide which method will be called by which name

default – Method which will be called if requested method is not available

Description

The remap method integrates CodeIgniter’s built in _remap method which is used to overwrite the behavior of calling controller methods over URI. To know details about using the _remap method you can read the article: CodeIgniter _remap method – Power and Benefits.

Typically programmers design the _remap method using multiple if-else or switch control structure so that the _remap method looks like:

But while using ANM_CI you will use an associative array as the alternate of the multiple if-else or switch control structure. The examples from bellow explain the implementation of the above script in terms of ANM_CI technique.

Note

If you use a ‘default’ key in your rules array, the value of default key will be considered as default method which you can also pass in the optional third parameter. If you use third parameter then default key will be ignored as default method. Here default method is the method which will be called if requested method is not available.

Parameters

Same as CodeIgniter’s redirect helper function.

Description

It works same as CodeIgniter’s redirect helper function. The extra benefit is, if CodeIgniter’s redirection does not work properly it tries to redirect using HTML meta tag and JavaScipt. If all the above attempts fail then it displays a redirection message with a link of the redirection URL.