Skip to main content
replaced http://magento.stackexchange.com/ with https://magento.stackexchange.com/
Source Link

I found answer in this questionquestion.

It can be done by using addHandle method:

if (//if condition) {
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_header');
}elseif(//if condition){
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_right'); 
 }

layout file

<layout>
  <custom_layout_handle_header>
     <reference name="header">
       <block type="core/template" name="header_block" template="template.phtml" />
     </reference>
  </custom_layout_handle_header>
</layout>

<layout>
  <custom_layout_handle_right>
     <reference name="right">
       <block type="core/template" name="right_block" template="template_file.phtml" />
     </reference>
  </custom_layout_handle_right>
</layout>

I found answer in this question.

It can be done by using addHandle method:

if (//if condition) {
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_header');
}elseif(//if condition){
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_right'); 
 }

layout file

<layout>
  <custom_layout_handle_header>
     <reference name="header">
       <block type="core/template" name="header_block" template="template.phtml" />
     </reference>
  </custom_layout_handle_header>
</layout>

<layout>
  <custom_layout_handle_right>
     <reference name="right">
       <block type="core/template" name="right_block" template="template_file.phtml" />
     </reference>
  </custom_layout_handle_right>
</layout>

I found answer in this question.

It can be done by using addHandle method:

if (//if condition) {
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_header');
}elseif(//if condition){
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_right'); 
 }

layout file

<layout>
  <custom_layout_handle_header>
     <reference name="header">
       <block type="core/template" name="header_block" template="template.phtml" />
     </reference>
  </custom_layout_handle_header>
</layout>

<layout>
  <custom_layout_handle_right>
     <reference name="right">
       <block type="core/template" name="right_block" template="template_file.phtml" />
     </reference>
  </custom_layout_handle_right>
</layout>
Source Link
JohnyFree
  • 1.5k
  • 3
  • 21
  • 35

I found answer in this question.

It can be done by using addHandle method:

if (//if condition) {
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_header');
}elseif(//if condition){
    $layout = $observer->getLayout();
    $layout->getUpdate()->addHandle('custom_layout_handle_right'); 
 }

layout file

<layout>
  <custom_layout_handle_header>
     <reference name="header">
       <block type="core/template" name="header_block" template="template.phtml" />
     </reference>
  </custom_layout_handle_header>
</layout>

<layout>
  <custom_layout_handle_right>
     <reference name="right">
       <block type="core/template" name="right_block" template="template_file.phtml" />
     </reference>
  </custom_layout_handle_right>
</layout>