Welcome Guest, Not a member yet? Register   Sign In
Internal Controller Redirect????
#1

[eluser]Freewolf[/eluser]
Is there a way to do an internal redirect within the same controller.

I want to check a few things in one method and if everything is not present to send control back to another method but all within the same controller. Is there a way to do this other than redirect()??
#2

[eluser]Narkboy[/eluser]
[quote author="Freewolf" date="1295666066"]Is there a way to do an internal redirect within the same controller.

I want to check a few things in one method and if everything is not present to send control back to another method but all within the same controller. Is there a way to do this other than redirect()??[/quote]

Not currently. You can't call a controller from a controller. Sad It's being looked at I believe.

You'll need to rethink your approach - perhaps have one controller function that checks and performs different actions depending on the results?

/B
#3

[eluser]Freewolf[/eluser]
I am not looking to redirect to a controller but to another method within the same controller.
Code:
class Some_controller extends Controller

function Some_controller ()
{ parent::Controller }

function index()
{
// do something
some_call_to_redirect_to_another_method('new_method');
}

function new_method()
{
// do something else now
something_more();
}

Make sense??

I need to do this as the way the user needs to get routed and the urls and the way the rest of the site interacts with this particular controller.
#4

[eluser]Narkboy[/eluser]
Did you try
Code:
$this->new_method();
?

As far as I know, there's no reason you can't call a function; you just can't redirect. What have you tried?

/B
#5

[eluser]InsiteFX[/eluser]
As Narkboy said!

Code:
class Some_controller extends Controller

function Some_controller ()
{
    parent::Controller
}

function index()
{
    if (TRUE)
    {
        // do normal stuff here
    }
    else
    {
        // do something else, call other method!
        $this->new_method();
    }
}

function new_method()
{
    // do something else now
    something_more();
}

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB