Closed creativecat closed 6 years ago
Hi! $data
is now protected and can be accessed by the getData()
method from Core class.
This is just some changes made to have better code with setter and getter to interact with each properties.
Mh... So the problem must be in the method for sub templates... I gonna take a look on it, maybe I find a solution to add a pull request!
Do you know where the method for sub templates is implemented? I couldn't find it yet... I search for something like {template [name] [data]}, but with no success...
Can you send me your custom class and the template having problem. I'll try to reproduce your problem!
For now I do some tests and everything is working fine for me
The (sub) template uses $_root to access a "global" variable. That call is causing the error message.
I was able to fix this in Compiler.php method parseVarKey (line 2721ff):
} elseif ($i === '_root' || $i === '__') {
// ---> old line #$output = '$this->data';
// ---> new line $output = '$this->getData()';
array_shift($m[2]);
array_shift($m[1]);
Hi @webbird thanks for that, can you do a PR, I don't work on this project anymore but will accept Pull-Request !
Of course. :)
I'm trying to define a sub template with
{template sub data}{/template}
Using this I got a fatal error because of data is set to protectedFatal error: Uncaught Error: Cannot access protected property CAT_Helper_Template_DwooDriver::$data in /[...]/templates/backstrap/templates/default/backend_nav_sidebar.tpl.d132.php:26
I'm using a child class, that extends Dwoo\Core to handle templates. Everything works fine with 1.1.0 as $data was set public. Is there a reason why this had been changed in current version?