I was trying to add a phtml file via update xml for one of my custom module
am pasting my config.xml file here
<config>
<frontend>
<routers>
<integer>
<use>standard</use>
<args>
<module>Foo_Bar</module>
<frontName>integer</frontName>
</args>
</integer>
</routers>
<layout>
<updates>
<integer>
<file>integer.xml</file>
</integer>
</updates>
</layout>
</frontend>
</config>
This works perfect for me.
I had learned that immediate node under the 'router' node is just an identifier.so i changed it to some other value and correspondingly i changed the immediate node under 'updates' also to the same value.but it was not working. then i thought my 'frontName' value should be the node under 'updates', and i changed accordingly. but again layout update was not working.
Queston: what should be the node under 'upates' node?
'frontName' value OR
the same node under 'routers' OR
both the nodes should match frontName value?
EDIT:
<config>
<frontend>
<routers>
<integer>
<use>standard</use>
<args>
<module>Foo_Bar</module>
<frontName>integer</frontName>
</args>
</integer>
</routers>
<layout>
<updates>
<something>
<file>integer.xml</file>
</something>
</updates>
</layout>
</frontend>
</config>
This config also working perfect for me.
Am getting increasingly curious about the relations now
UPDATE:My layout updates are only working when my <frontName>
value matches the node name immediately under <routes>
node. But routes work properly if they are not same
Somebody please explain my problem.or is it not a problem?
Best Answer
Unless you are executing an action in your module's controllers, there is no connection between the router configuration node and the layout file configuration node.
The only connection between router configuration and layout is the layout update handles for your module's controllers. If you were accessing your
IndexController::indexAction()
, the full action name layout handle would be<integer_index_index>
. Change the arbitrary router configuration node to something else and you would need to update your layout XML. This is the main purpose of the frontName - it can be changed.