php - How can I pass variables to main view in phalconphp -


how can pass variables main view, not view controller.

in fact want share piece of data across views. how can in phalcon.

for instance, in laravel, can use:

view::share('variable', $value);

you create service - if simple variable overkill work.

<?php      // in bootstrap file     $di->setshared('variable', 41); ?> 

then in view (or controller or di injectable) avaiable $this->variable. ie:

// view <?php echo $this->variable; ?>  // or using volt {{ variable }} 

the variable of course can object. such simple variables i'm using config object, ie: {{ config.facebook.fbid }}.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -