// in controller, action_index():
$view = \View::forge('main_template');
$view->set_global('test_global', 'aaa');
$view->set('test_local', 'bbb');
$this->template->content = $view;
// in main_template.php:
<?php
$view = \View::forge();
// $view->set('test_local', $test_local); // I would like to avoid this
echo $view->render('menu');
?>
// in menu.php:
echo $test_local.' '.$test_global;
I do not wish to use \View::set_global() because I am using other templates on the same call too (and they do not need the assigned data). Is it possible to assign all variables from the current template to the sub-template?
I hope my question makes sense...
echo \View::forge('menu')->set($__data, null, false);
It looks like you're new here. If you want to get involved, click one of these buttons!