Welcome Guest, Not a member yet? Register   Sign In
Rerouting a function or changing its url
#6

[eluser]chrisrivera[/eluser]
Glad to hear that I could help.

Something else you may want to consider if doing a more internal redirect without calling redirect.

An example would be, if you have the Registration controller called, you can have a method called logout() that would do the logging out, then you could call internally a function that would show your login page, and pass a parameter either in the method call directly or by passing the value in a variable within the class, so that when you call the method that display the login page, the value of the message would be passed along.

Here is a hacked up code sample based on a controller class I use for my code where I do something similar.

Code:
class Registration extends Controller
{
  var $message = '';

  ...your existing code...

  function logout()
  {
    ... do the logout functionality here ...

    $this->message = 'You have been logged out.';
    $this->showLogin();
  }

  function showLogin()
  {
    $this->load->view('login', $this->message);
  }
}

This way you're passing the value internally and you don't have to worry about the message getting passed along in the url. I'm curious to hear how others feel about this technique when it comes to dealing with messages like this within the controller.


Messages In This Thread
Rerouting a function or changing its url - by El Forum - 04-22-2008, 12:10 PM
Rerouting a function or changing its url - by El Forum - 04-22-2008, 01:07 PM
Rerouting a function or changing its url - by El Forum - 04-22-2008, 01:35 PM
Rerouting a function or changing its url - by El Forum - 03-12-2009, 08:34 AM
Rerouting a function or changing its url - by El Forum - 03-12-2009, 09:11 AM
Rerouting a function or changing its url - by El Forum - 03-12-2009, 11:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB