问题描述
我希望在后端(在"design/adminhtml"下)重用某个前端UI元素.这主要包括重用模板(phtml).但是,从后端引用前端布局句柄似乎更好. magento是否提供共享UI组件的位置,将它们声明为共享的方法或通过frontend/adminhtml分隔引用它们的机制?谢谢
I wish to reuse a certain frontend UI element on the backend (under "design/adminhtml"). This would mostly consist of reusing the template (phtml). However, referencing the frontend layout handle from the backend would seem even better. Does magento provide a location for shared UI components, a way to declare them as shared, or a mechanism for referencing them across the frontend/adminhtml divide? Thanks
推荐答案
@coriscus是的,那是可能的.我从管理员那里找到了使用前端模板的窍门.
@coriscusYes that is possible. I found the trick you use frontend template from admin.
public function __construct()
{
parent::__construct();
$this->setData('area','frontend');
$this->setTemplate('customer/online.phtml');
}
只需在块构造函数中设置所需的区域即可.
just set needed area in block constructor.
这篇关于在magento的前端和后端之间共享模板(admin或adminhtml)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!