I have developed dashboard.phtml in my module Admin/view/layout/dashboard.phtml
Now I have developed another module like restaurants now I want to use dashboard.phtml in all action of restarunts module I tried below.
my module.config.php
'view_manager' => array(
'template_map' => array(
'layout/default' => __DIR__ . '/../../Admin/view/layout/dashboard.phtml'
),
'template_path_stack' => array(
'restaurants' => __DIR__ . '/../view',
),
my indexaction of restaurantsController.php
public function indexAction()
{
$viewModel = new ViewModel();
$viewModel->setTemplate('layout/default');
$restaurant_info_array = array();
$restaurant_info = $this->getRestaurantsTable()->fetchAll();
$i = 0;
foreach ($restaurant_info as $ri)
{
$restaurant_info_array[$i]['id'] = $ri->id;
$restaurant_info_array[$i]['name'] = $ri->name;
$restaurant_info_array[$i]['published'] = $ri->published;
$restaurant_info_array[$i]['email'] = $ri->email;
$is_menu_available = $this->getRestaurantsTable()->getRestaurantsMenu($ri->id);
$restaurant_info_array[$i]['res_menu'] = count($is_menu_available);
$i = $i+1;
}
$viewModel->setVariables(array(
"restaurants"=>$restaurant_info_array
));
it is not working please help me if I call dashboard as my default layout for my admin side modules it will be great coz It is not logical same dashboard.phtml lies in all folders of my modules.