从Magento外部抓取Magento phtmls,同时保持数据完整

从Magento外部抓取Magento phtmls,同时保持数据完整,magento,frameworks,enterprise,Magento,Frameworks,Enterprise,如何获取以下文件的内容 frontend/enterprise/default/template/page/html/header.phtml或 frontend/base/default/template/page/template/links.phtml或 frontend/enterprise/default/template/checkout/cart/cartweader.phtml 在Magento之外,处理日期仍保持不变。 就像我的意思一样,仍然显示用户“我的购物车(5)”的正确项

如何获取以下文件的内容
frontend/enterprise/default/template/page/html/header.phtml
frontend/base/default/template/page/template/links.phtml
frontend/enterprise/default/template/checkout/cart/cartweader.phtml

在Magento之外,处理日期仍保持不变。 就像我的意思一样,仍然显示用户“我的购物车(5)”的正确项目数,或者在标题中显示“欢迎,volkan yavuz”,并且仍然显示用户的名称

我为什么要这个

我有一个独立于Magento的zend应用程序,我们正在尝试合并页眉和页脚,所以我们将它们放在一个地方。我们需要从这个zend应用程序调用Magento头


到目前为止,我在Magento中创建了一个调用这些文件(phtml)的自定义API,但我似乎无法获取这些已处理的数据(如当前会话/用户的购物车编号或欢迎名字/姓氏信息)。

为了使用正确的数据和状态渲染这些文件,它们必须具有正确的渲染环境

<?php
include 'app/Mage.php';
Mage::app('store_code');

//Load the session so we get quotes.
Mage::getSingleton('core/session', array('name' => 'frontend'))->start();
/*
   see Mage_Core_Controller_Varien_Action::preDispatch()
   and Mage_Core_Controller_Front_Action::preDispatch()
*/

//For each block you wish to render, you could do the following:
$output = Mage::app()->getLayout()
                     ->createBlock('block/type')
                     ->setTemplate('template/path.phtml')
                     ->toHtml();