• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Caching with logged in/not logged in or ecommerce basket views (idea for solution?)

I really want to use some caching as the app I am building is getting fairly complicated with lots of queries and lots of joins.

Anyway, the problem is there is a user menu if they are logged in or a login box if they are not. CI caching doesn't deal with that, it just cache's the whole page.

A possible solution, which I am about to try in a minute would be to use javascript/ajax to spit out the login box / user menu.

It's not even going to impact on SEO because it's not really somewhere you want the search engines to be going.

I'll let you know how I get on

Yep, works a treat!

Put a bit of jQuery ajax in the header to call a menu controller
           url: "<?=base_url();?>menu/index",
           global: false,
           type: "POST",
           async: false,
           dataType: "html",
           data: "",
           success: function (response)


Menu controller just chooses which view to load depending on user status:
class Menu extends Controller {
    function Menu()
    function index()
        if($this->freakauth_light->isValidUser()){ // are they logged in??


That's may be not good, but I'll try. Thanks

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.