Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How can I show Magento’s header HTML in an external PHP application? 
 
EthanHawk
Jr. Member
 
Total Posts:  2
Joined:  2009-07-14
 

I would like to show Magento’s header in an external PHP application (a CMS).
I tried to call Magento from my PHP in the way below, but it has only shown a ‘default welcome msg’ and topLinks are missing.

require_once '/webshop/magento/app/Mage.php';
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$layout Mage::getSingleton('core/layout');
$block $layout->createBlock("page/html_header"); 
$block->setTemplate("page/html/header.phtml"); 
echo 
$block->toHtml();

Any idea how can I do it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
EthanHawk
Jr. Member
 
Total Posts:  2
Joined:  2009-07-14
 

I tried to show the product list, it worked well. See the code below:

require_once '/webshop/magento/app/Mage.php';
umask(0);
Mage::app('default');
Mage::getSingleton('core/session', array('name' => 'frontend'));
$block Mage::getSingleton('core/layout')
    ->
createBlock("catalog/product_list""featured", array('category_id'=>3))
    ->
setTemplate("catalog/product/list.phtml");
echo 
$block->toHtml();

So I guess I didn’t use the proper block or template for the topLinks?
Any idea?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top