I've been reading some tutorials and some use:


To get the current layout, while others use:


I was wondering if there's any difference between the two approaches.

The calls are being run from a controller class that extends Mage_Core_Controller_Front_Action.


1 Answer 1


$this->getLayout() is a shortcut for Mage::getSingleton('core/layout'), so technically there is no difference.

But note that, Mage::getSingleton('core/layout') works everywhere, while $this->getLayout() only works in controllers or blocks, i.e. classes that implement this shortcut method.


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.