Welcome Guest, Not a member yet? Register   Sign In
Caching with logged in/not logged in or ecommerce basket views (idea for solution?)
#2

[eluser]surfgatinho[/eluser]
Yep, works a treat!

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

                    $("#userMenu").append(response);
                   }
                  
          });
       });
    [removed]

Menu controller just chooses which view to load depending on user status:
Code:
<?php
class Menu extends Controller {
    
    function Menu()
    {
         parent::Controller();
        
    }
    
    function index()
    {
        
        if($this->freakauth_light->isValidUser()){ // are they logged in??
        $this->load->view($this->config->item('FAL_template_dir').'template/user_menu_in');
    }
    else{
        $this->load->view($this->config->item('FAL_template_dir').'template/user_menu_out');
    }

  }
}
?>


Messages In This Thread
Caching with logged in/not logged in or ecommerce basket views (idea for solution?) - by El Forum - 08-24-2008, 02:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB