Welcome Guest, Not a member yet? Register   Sign In
alternatives to redirect command
#1

[eluser]august.gresens[/eluser]
hello

Just finished a fantastic book about web site optimization (High Performance Web Sites by Steve Sounders).

This book points out that using redirects slows down page loading due to the extra interactions between the client and server

In my current project I'm using a bunch of redirects to invoke controller methods. For example, on logout from my user controller, I want to redirect to the home page of my main controller.

function logout()
{
$this->_logOut();
redirect('main/home');

}

Is there a way I can invoke a method on another controller to achieve the same effect without using a redirect?

Thanks,

August
#2

[eluser]stuffradio[/eluser]
You could go,

Code:
$this->load->view('main/home');

Not sure that's the best alternative though...
#3

[eluser]august.gresens[/eluser]
Thanks - that will only invoke the view though. What I really want to do is invoke a method on a different controller. Does anyone know how this is done? A
#4

[eluser]janogarcia[/eluser]
Hi, Take a look at this library Wick 0.80 (beta) - Controller Loader
#5

[eluser]Randy Casburn[/eluser]
Hi august.gresens,

You mentioned that this book was about "web site optimization". Did the book have a chapter about "software states" or "state machines" or the idea behind moving your application between one state and another state.

Most people think of web applications as being "stateless", but as soon as you bring in the component of authentication and access control, you've added some form of state control and state awareness.

A logout routine may be one instance where a redirect may be beneficial. This will allow your state machine to move out of a "logged in" state (redirect) to a "logged out" state with absolute certainty since your CI authentication routines will see the redirected browser as a new visitor.

Otherwise, you will have to write new internal controls to manipulate the state to provide the assurances that user is, in fact logged out, with certainty.

I hope this is helpful.

Randy
#6

[eluser]beemr[/eluser]
I don't think Steve Sounders would have a problem with redirecting on logout. His mission is to push the momentum of communication towards the user. That's why he advocates things like js in the footer and css served from a different domain. He wants the user to be able to act at the earliest possible moment.

In the case of a global logout, you've already pushed the auth process as far into the user's court as you can. The user can decide to logout no matter where they are in their visit. Mission accomplished.

Remember, Steve works (or worked?) for Yahoo, and look at what they do. They redirect both at log in and log out.
#7

[eluser]Randy Casburn[/eluser]
Right -- I've got all that beemr -- Please review the OP's original post. I was just reflecting on the OP's example use case. Please...redirect to log your users out!

I'm down with the Yahoo dude. I'm not challenging the G O Ds here. Please don't strike up the lighting generators...

jk...man -- you with me ;-)

Randy
#8

[eluser]beemr[/eluser]
[quote author="Randy Casburn" date="1216858624"]jk...man -- you with me ;-)[/quote]

Fear not. At $5 a gallon, even the G O D S can't keep their generators running :-S




Theme © iAndrew 2016 - Forum software by © MyBB