Is it possible to call phtml of backend in frontend?
-
12-12-2019 - |
Question
I want to call two phtml in frondend which is admin side phtml
is it possible to call phtml of backend in customer account?
if yes than i want to call this two phtml:
adminhtml\default\default\template\downloadable/product/edit/downloadable/samples.phtml
adminhtml\default\default\template\downloadable/product/edit/downloadable/links.phtml
how to call this phtml?
Solution
In theory you can do it, I think, by emulating the backend for a frontend area. You can do the emulation like this:
$adminStoreId = 0;
$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($adminStoreId);
//your magic here
//then stop the emulation
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
But this is not a good practice. If you have urls in the templates you mentioned then they will be generated using the admin helper and you end up with a strainge key
parameter.
Not to mention that it may not fit with your design.
I suggest you just clone the templates to frontend and keep frontend separate from backend.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange