Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

layout xml conditional of $_request params

Tags:

layout

magento

I understand it's in theory possible to use system config to determine the layout of a page (with the ifconfig option), is it possible to do something similar with variables passed by get or post? Or a cookie value for that matter?

like image 568
Alex Hadley Avatar asked Mar 13 '26 05:03

Alex Hadley


1 Answers

This is not possible in standard Magento.

Depending on your use case there are some ways:

  1. Implement an own XML attribute, for example <action method="foo" ifrequestvar="..."> The modle Aoe_LayoutConditions could give you a starting point:

  2. Add an own layout handle. i.e. you check your condition that should be meet in normal PHP code (that works if the condition, i.e. the value of your $_REQUEST var is always the same) and then you can use this layout handle in the layout XML. You can add layout handles in an observer as shown in N98_CustomLayoutHandles.

like image 63
Alex Avatar answered Mar 15 '26 06:03

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!