モジュールAdmin/view / layout/dashboard.phtmlでdashboard.phtmlを開発しました
今、私はレストランのような別のモジュールを開発しました。次に、以下で試した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のインデックスアクション
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はモジュールのすべてのフォルダーにあります。