2
加载/获取Magento路由之外的块以供外部使用
我有一个外部网页,我试图从Magento框架中提取站点标题块,以用作此外部页面中的标题。这是我到目前为止所拥有的: // initialize Magento $rootPath = dirname(dirname(__FILE__)); $mageInc = $rootPath . "/app/Mage.php"; include_once $mageInc; Mage::app('admin')->setCurrentStore(0); $headerBlock = Mage::app()->getLayout()->createBlock('page/html_header'); //also tried //$headerBlock = Mage::app()->getLayout()->createBlock('page/html_header', 'header'); 执行在那里停止,但是,我没有收到任何错误消息。我的目标是拉出block Mage_Page_Block_Html_Header,我认为我可以用来<block type="page/html_header" name="header" as="header">从page.xml布局文件中加载所有内容。该XML标签包装在里面 <default translate="label" module="page"> <block type="page/html" name="root" output="toHtml" template="page/1column.phtml"> 标签,所以也许我需要以某种方式指定它?我不确定自己在做什么错以及从这里去哪里。