I'd like to display pages in window.js popup. I created custom block that is template/page/popup.phtml (for parent template) and popup/view.phtml to display content. I'm passing specific url for JavaScript Window library and it's visible in my block as "url" request param. Then I'd like to render just specific fragment (content) of layout.

In custom block I have method:

public function getContentHtml()
    $layout = Mage::app()->getLayout();
    return $layout->getBlock('content')->toHtml();

which return current page layout - not requested url layout. How to getLayout for url passed in request?

This is my approach bacause I'm not sure how to differ/change layout XML when page is loaded within template/page/popup.phtml and template/page/2columns-right.phtml.

1 Answer 1


Atwix has a nice post about getting a block or part of page as ajax that should help you.

You'll need to create your own module with controller and layout XML to do so then set the block you want to load as the root block in the controllers layout XML handle.

Then call the controller that returns the block via the url [your module]/[controller]/[method]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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