在magento的前端和后端之间共享模板(admin或adminhtml) [英] sharing template between frontend and backend (admin or adminhtml) in magento

查看:87
本文介绍了在magento的前端和后端之间共享模板(admin或adminhtml)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在后端(在"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 是的,那是可能的.我从管理员那里找到了使用前端模板的窍门.

@coriscus Yes 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆