Welcome Guest, Not a member yet? Register   Sign In
Shopping Card Bugs
#10

[eluser]nikokolev[/eluser]
Ok guys. So i finally fixed this little bug thanks to the help of a friend of mine who has used CI for a while. As some of you guessed, this is a cache problem. The only thing you need to do is to force PHP headers like so:

Code:
header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );

header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', false ); header( 'Pragma: no-cache' );

You can do a private function in your controller so that it's not accessible from outside and call it in your relative add, delete, destroy methods. The private function must look something like this:

Code:
private function _set_headers() {
    header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
    header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i(worry)' ) . ' GMT' );
    header( 'Cache-Control: no-store, no-cache, must-revalidate' );
    header( 'Cache-Control: post-check=0, pre-check=0', false );
    header( 'Pragma: no-cache' );
}

And you call it inside the other functions like so:

Code:
$this->_set_headers();

Remember that this will work only in the scope of the class. You can't call this function in other controllers and it can't be accessed from outside the scope, cause it's not public.

Thanks to you all!!


Messages In This Thread
Shopping Card Bugs - by El Forum - 05-04-2013, 05:31 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 06:38 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 09:58 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 10:26 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 10:37 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 11:01 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 11:07 AM
Shopping Card Bugs - by El Forum - 05-04-2013, 11:11 AM
Shopping Card Bugs - by El Forum - 05-05-2013, 12:40 AM
Shopping Card Bugs - by El Forum - 05-06-2013, 09:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB