×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Sep 26, 2014 11:29 AM
Views: 65
Load / Get a block outside of Magento routing for external use
  1.  
  2. <?php
  3. include_once "app/Mage.php";
  4. umask(0);
  5. Mage::app()->loadArea('frontend');
  6.  
  7. $layout = Mage::getSingleton('core/layout');
  8.  
  9. //load default xml layout handle and generate blocks
  10. $layout->getUpdate()->load('default');
  11. $layout->generateXml()->generateBlocks();
  12.  
  13. //get the loaded head and header blocks and output
  14. $headBlock = $layout->getBlock('head');
  15. $headerBlock = $layout->getBlock('header');
  16. echo $headBlock->toHtml() . $headerBlock->toHtml();