Skip to main content
added 3 characters in body
Source Link
Prince Patel
  • 22.9k
  • 10
  • 98
  • 121

I have an external webpage and I'm trying to pull the site header block from the Magento framework to use as a header in this external page. This is what I have so far:

// 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');

Execution stops there, however, and I get no error messages. My goal is to pull block Mage_Page_Block_Html_Header, which I think I can use to load <block type="page/html_header" name="header" as="header"> and all its contents from the page.xml layout file. That xmlXML tag is wrapped inside

<default translate="label" module="page">
  <block type="page/html" name="root" output="toHtml" template="page/1column.phtml">

tags, so maybe I need to specify that somehow? I'm not sure what I'm doing wrong and where to go from here.

I have an external webpage and I'm trying to pull the site header block from the Magento framework to use as a header in this external page. This is what I have so far:

// 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');

Execution stops there, however, and I get no error messages. My goal is to pull block Mage_Page_Block_Html_Header, which I think I can use to load <block type="page/html_header" name="header" as="header"> and all its contents from the page.xml layout file. That xml tag is wrapped inside

<default translate="label" module="page">
  <block type="page/html" name="root" output="toHtml" template="page/1column.phtml">

tags, so maybe I need specify that somehow? I'm not sure what I'm doing wrong and where to go from here.

I have an external webpage and I'm trying to pull the site header block from the Magento framework to use as a header in this external page. This is what I have so far:

// 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');

Execution stops there, however, and I get no error messages. My goal is to pull block Mage_Page_Block_Html_Header, which I think I can use to load <block type="page/html_header" name="header" as="header"> and all its contents from the page.xml layout file. That XML tag is wrapped inside

<default translate="label" module="page">
  <block type="page/html" name="root" output="toHtml" template="page/1column.phtml">

tags, so maybe I need to specify that somehow? I'm not sure what I'm doing wrong and where to go from here.

edited title
Link
Nick Rolando
  • 1.2k
  • 5
  • 17
  • 36

Create Load / LoadGet a block outside of Magento routing for external use

Tweeted twitter.com/#!/StackMagento/status/337705415422926848
Source Link
Nick Rolando
  • 1.2k
  • 5
  • 17
  • 36

Create / Load a block for external use

I have an external webpage and I'm trying to pull the site header block from the Magento framework to use as a header in this external page. This is what I have so far:

// 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');

Execution stops there, however, and I get no error messages. My goal is to pull block Mage_Page_Block_Html_Header, which I think I can use to load <block type="page/html_header" name="header" as="header"> and all its contents from the page.xml layout file. That xml tag is wrapped inside

<default translate="label" module="page">
  <block type="page/html" name="root" output="toHtml" template="page/1column.phtml">

tags, so maybe I need specify that somehow? I'm not sure what I'm doing wrong and where to go from here.