1
我已經開發dashboard.phtml在我的模塊管理/視圖/佈局/ dashboard.phtml如何在ZF2中調用所有模塊或選定模塊的默認佈局?
現在,我已經開發瞭如餐館的另一個模塊現在我想在restarunts模塊的所有動作我在下面試圖用dashboard.phtml。
我module.config.php
'view_manager' => array(
'template_map' => array(
'layout/default' => __DIR__ . '/../../Admin/view/layout/dashboard.phtml'
),
'template_path_stack' => array(
'restaurants' => __DIR__ . '/../view',
),
我restaurantsController.php的的indexAction
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
));
它不工作,請幫助我,如果我叫儀表板作爲我的默認佈局爲我的管理端模塊這將是偉大的因爲這是不合邏輯的dashboard.phtml位於我的模塊的所有文件夾。