6

I asked the question but did not get an answer to it. Now i understand how get all block in pages, but i get only current page blocks. For example:

  $layout = Mage::app()->loadArea(Mage_Core_Model_App_Area::AREA_FRONTEND)->getLayout();
  /* then i get all blocks from that page*/

How to get frontend area, when i in backend?? I know that it should be simple, but when i want get AREA_FRONTEND, i get my current page, but i need get frontend area.

5

Old question, but here goes.

Have not tried this myself, but may help in the right direction. $selectedStoreId will be the id of the sore who's theme you want to get to. This is how preview in magento EE does it.

Mage::app()->getLocale()->emulate($selectedStoreId);
Mage::app()->setCurrentStore(Mage::app()->getStore($selectedStoreId));

Mage::getDesign()->setArea('frontend')
        ->setStore($selectedStoreId);

$designChange = Mage::getSingleton('core/design')
        ->loadChange($selectedStoreId);

if ($designChange->getData()) {
    Mage::getDesign()->setPackageName($designChange->getPackage())
            ->setTheme($designChange->getTheme());
}

and use Mage::app()->getLocale()->revert(); to go back to admin theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.