-1

I want write one variable to access any action into same controller. I write one shared or global variable.

I using, Kohana 3.1.

It's possible !? I don't find any example or people with same question.

1 Answers1

0

How about using a class property?

<?php defined('SYSPATH') or die('No direct script access.'); 

class Controller_Application extends Controller_Base {
      public $variable = FALSE;

      /* This will echo true */
      public function action_index()
      {
            $this->variable = TRUE;
            echo Debug::vars($this->variable);
      }

      /* This will echo false */
      public function action_variable()
      {
            echo Debug::vars($this->variable);
      }
}
Peter
  • 2,276
  • 4
  • 32
  • 40