Welcome Guest, Not a member yet? Register   Sign In
Using cache in an extended Controller
#1

[eluser]Unknown[/eluser]
Hi

I'm going to use cache library for my website. After having ask some questions on IRC, I finally found a way to see a cache file in my cache folder with this :
Code:
class User extends CI_Controller
{

//Constructeur
public function __construct()
{
  parent::__construct();
  
}

//contrôleur index
public function index()
{
  
  $this->output->cache(50);
   $this->load->view('index',array('foo'=>'foo'));

}

but if I use MY_Controller instead of CI_Controller for the extension of my User class, the cache doesn't work
this is an extract from my class MY_Controller :
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class MY_Controller extends CI_Controller{
  public $title;

function __construct(){
  parent::__construct();
  
  
  $this->output->enable_profiler(TRUE);

}




//affichage output
function _output($output){
  
  //si connecté on affiche son nom
  if($this->session->userdata('t_code'))
  {
   $user = $this->getPseudo($this->encrypt->decode($this->session->userdata('t_code')));
  
   echo $this->load->view('template/header',array(
    "title"=>$this->title,"name_user"=>$user
    ), true);
  }
  else
  {
    echo $this->load->view('template/header',array(
    "title"=>$this->title
   ), true);
  }  

  echo $this->load->view('menu/menu',null,true);
  echo $this->load->view('template/container',null,true);
  echo $output;
  echo $this->load->view('template/footer',null, true);
}

Can someone please tell me what's wrong with my code ?

Thanks
Matt




Theme © iAndrew 2016 - Forum software by © MyBB