Questions should go to https://forum.phalconphp.com
Documentation issues should go to https://github.com/phalcon/docs/issues
Describe what you are trying to achieve and what goes wrong.
Setting variables to the view in a controller does not take effect.
```
$testKey = "testKey";
$this->view->testkey = $testKey;
in volt template file:
{{ testKey }} will get empty value.
But:
` $this->view->setVar("testKey", $testKey);`
This method is correct. The view will get previous value assigned in controller.
> Provide output if related. Provide coredump if any. Use
```php
// paste output here
Provide minimal script to reproduce the issue
// paste code
php --ri phalcon)Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.1.2
Build Date => Jun 4 2017 17:28:45
Powered by Zephir => Version 0.9.7-1fae5e50ac
Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
php -v)PHP 7.0.19 (cli) (built: Jun 4 2017 17:25:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans
with Zend OPcache v7.0.19, Copyright (c) 1999-2017, by Zend Technologies
Zephir version (if any):
Server: Nginx | Apache | Other
Nginx
$this->view->testkey must be $this->view->testKey for {{ testKey }}
Oh...I'm really sorry making such a silly mistake.
Most helpful comment
$this->view->testkeymust be$this->view->testKeyfor{{ testKey }}