7

Can u confirm if the layout xml file im using is of the proper format

routerfrontname_controllerfrontname_controlleraction.xml

Eg:

routes.xml

<router id="standard">
    <route id="something" frontName="s"/>
</router>

Controller path:

Controller/Result/Index.php

Then my layout file will be as :

s_result_index.xml? Am I correct.

1) Can the "route id" and "frontName" be different?

2) If it is different too, then we use route frontname (ie 's' in my case). Correct?

2 Answers 2

13

Front name and route id can be different, but you should use id in file names.

Correct format is: routeid_controllerfrontname_controlleraction.xml

So it should be something_result_index.xml.

5
  • 1
    I think you meant to type routeid not routerid.
    – thdoan
    Feb 16, 2017 at 10:40
  • how about the camelCased controller action names, like: MyAction, that is converted to routerid_countrollerfrontname_my-action or routeid_countrollerfrontename_myaction ? Apr 11, 2018 at 11:26
  • can frontname be front_name? what would be the layout name in this case? May 16, 2019 at 9:41
  • This is what I am looking for. Thank you very much
    – huykon225
    Oct 23, 2020 at 8:54
  • How about if my router name as fastsms/otpVerification/index/? My layout name as fastsms_otpVerification_index but it is not working
    – Butterfly
    Dec 16, 2020 at 14:19
0
cms_page_view_id_yourpageurl.xml

this is for custom page made from backend and want to add css and js then create a file like above and insert your xml code into it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.