Is there a way to get which layout is used in specific phtml files?
Here, in my case, I want to check which layout is used in the /list.phtml directory, I used this information to make a conditional “if” on the size of the product image grid.
I tried to do this. But the whole result is just an explanation of things in the xml layout. The closest key I received is the stream
Magento get layout for this page
which talked about using this snippet
$left_block = $this->loadLayout()->getLayout()->getBlock('left');
but when i tried it in phtml files i got an exception error
UPDATE
joe answer below gave me some more clues, exception passed. But the behavior is not quite what I need. This piece of code seems to just check if the specified block is defined in XML. I really need to see if this block exists on a specific page.
In my case, I need to check which layout is used in the /product/list.phtml directory. if it is 3 columns, i'm going to reduce the size of the image. If it is 1 column, I will do it more.
Is there any way to do this?
Kamal
source share