Part of the EllisLab Network
x
 
Create New Page
 View Previous Changes    ( Last updated by George Petsagourakis )

Forward

Category:Library -> Controller | Category:Library -> Community

Introduction

Forward allows you to jump from one controller to other once the execution of the first is finished.

Requirements

CodeIgniter 1.6.2

Download

File:forward 1.6.2-0.1.zip

Included files

Core
codeigniter/CodeIgniter.php
libraries/Controller.php
libraries/URI.php

Example
application/controllers/test.php
application/controllers/welcome.php

Install

You must overwrite the 3 CI files listed in included files in Core. If you have a local modification of them, back up your files before.

Usage

Your controllers will have a method named “forward” which receives an arbitrary number of parameters. Once the controller execution is finished, CodeIgniter will continue executing the forwarded method.

The parameters can be:
an URI string (for example “welcome/index/argument”)
many strings (for example “welcome”, “index”, “argument”)
an array with strings (array(“welcome”, “index”, “argument”))

Any of these examples will generate the same URI.
The URI will be routed using your custom route rules.
If any of the forwarded controllers is not found, a 404 error page will be displayed.
Also, all loaded models and libraries will persist on the forwarded CI object.