I have an external webpage say "test.php" and I have loaded the site header & footer block from the Magento framework to use as a header & footer in this external page. Everything is working fine except url links. This is what I have done so far:
include 'app/Mage.php'; Mage::app(); umask(0); Mage::app()->loadArea('frontend'); Mage::getSingleton('core/session', array('name' => 'frontend')); $layout = Mage::getSingleton('core/layout'); //load default xml layout handle and generate blocks $layout->getUpdate()->load('default'); $layout->generateXml()->generateBlocks(); //load header $headBlock = $layout->getBlock('head'); $headerBlock = $layout->getBlock('header'); echo $headBlock->toHtml() . $headerBlock->toHtml(); // load footer $footerBlock = $layout->getBlock('footer'); echo $footerBlock->toHtml();
The problem is url link generated at this page includes test.php in its base url.
Say I have a link "About Us". The url generated for this link in magento is "http://localhost/myapp/index.php/about.html" But url generated for the same link on test.php is "http://localhost/myapp/test.php/about.html".
How this can be resolved?
Is there any other way to load theme's header and footer?