Hi Folks, the variable $_monthNumber is defined protected in the class und used in the functions initialize and guvpdf.
I get the error: undefined variable in guvpdf, bute why??
As I understood protected variables are visible in the same class. I have used it with $this and without-
class JournalsController extends AppController {
protected $array;
protected $product;
protected $_monthNumber;
public function initialize() {
parent::initialize();
$this->set('menuID', 'accounts');
$this->set('product', 'product3');
$this->loadComponent('accountUpdate');
$this->loadComponent('divTools');
$timestamp = time();
$_monthNumber = date("n", $timestamp);
}
public function guvpdf() {
$actYear = Configure::read(‘actualYear’);
$months = Configure::read(‘Months’);
$orient = ‘portrait’;
.
.
$this->set(‘month_number’, $this->$_monthNumber);
$this->set(‘month_names’, $months);
}