Opencart 如何在主页上显示另一个页眉模板?

Opencart 如何在主页上显示另一个页眉模板?,opencart,opencart2.x,opencart-3,Opencart,Opencart2.x,Opencart 3,我得到了一个头.twig文件。我需要在主页中以不同于其他页面的方式显示此标题模板。怎么做?制作两个文件,header.twig和home\u header.twig 在catalog/controller/common/header.php中有一个函数index(),它使用header.twig 在header.php中编写另一个方法,例如index_home(),并复制此函数中的index()主体(如果需要,进行任何更改) 在索引_home()中更改 return $this->load

我得到了一个
头.twig
文件。我需要在主页中以不同于其他页面的方式显示此标题模板。怎么做?

制作两个文件,header.twighome\u header.twig

在catalog/controller/common/header.php中有一个函数index(),它使用header.twig

header.php中编写另一个方法,例如index_home(),并复制此函数中的index()主体(如果需要,进行任何更改)

索引_home()中更改

return $this->load->view('common/header', $data);

如果您检查每个控制器的功能,则有一条线

$data['header'] = $this->load->controller('common/header');
这将调用header.twig 无论您需要使用哪种功能,您都可以替换

$data['header'] = $this->load->controller('common/header');
在该函数中

$data['header'] = $this->load->controller('common/header/index_home');

这将使用home\u header.twig

创建两个文件,header.twighome\u header.twig

在catalog/controller/common/header.php中有一个函数index(),它使用header.twig

header.php中编写另一个方法,例如index_home(),并复制此函数中的index()主体(如果需要,进行任何更改)

索引_home()中更改

return $this->load->view('common/header', $data);

如果您检查每个控制器的功能,则有一条线

$data['header'] = $this->load->controller('common/header');
这将调用header.twig 无论您需要使用哪种功能,您都可以替换

$data['header'] = $this->load->controller('common/header');
在该函数中

$data['header'] = $this->load->controller('common/header/index_home');

这将使用主标题。细枝

你能在这里看到我的问题吗请:好的让我检查你能在这里看到我的问题吗请:好的让我检查