Welcome Guest, Not a member yet? Register   Sign In
functions within controllers
#4

[eluser]khagendra[/eluser]
This can be done by two ways.

1. By using the redirect() function of the url helper. for this the helper url need to be load in the controller.

2. $this->functionName();

Here is an example that demonstrate both the ways

Code:
class Example extends Controller {
    
    function Example()
    {
        parent::Controller();
        
        $this->load->helper('url');
    }
    
    function index()
    {
        $this->show();
    }
    
    function show1()
    {
        echo "two";
    }
    
    function show()
    {
      redirect('example/show1');
    }
}

Try this, it will work.

Quote:Note: the url helper only need to load if u wnat to use redirect('controller/function')


Messages In This Thread
functions within controllers - by El Forum - 10-20-2009, 09:57 AM
functions within controllers - by El Forum - 10-20-2009, 10:03 AM
functions within controllers - by El Forum - 10-20-2009, 10:06 AM
functions within controllers - by El Forum - 10-20-2009, 10:53 AM
functions within controllers - by El Forum - 10-20-2009, 03:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB