I have a custom controller accessed at the path /custommodule/customer/info
which is loading the 2columns-left.phtml
template on the root
node as follows:
<custommodule_customer_info>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</custommodule_customer_info>
What I would like to do is update the root template for customers who are not logged in, something such as:
<customer_logged_out>
<custommodule_customer_info>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</custommodule_customer_info>
</customer_logged_out>
I understand that I can't target multiple layout handles in this fashion, but the intent should be clear; update the root template for this layout handle while customers are not logged in.
I had thought that I could target my controller's handle with the following:
<customer_logged_out>
<reference name="custommodule_customer_info">
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</reference>
</customer_logged_out>
This indeed does update the root template with the 1column.phtml
template, but it is doing so on what appears to be all pages instead of just the page targeted in my reference
node.
I have tried several permutations of this layout update, but none seem to work. How can I target this one layout handle while at the same time using the customer_logged_out
layout handle?
— edit —
To be clear, this is actually a third-party module.
Best Answer
Since you are using your own controller you don't need to only use the default handles. Based on the logged in status you could add in your infoAction method
or
and then in your layout.xml file use
and
-- addition after your edit below --
Seeing that you don't want to edit the controller (since it is a 3rd party extension), I would create a separate extension that only observes controller_action_layout_load_before