To maintain readability I have been taught to indent each block of xml, such as the below:
On the block that this xml is located, Magento will call the function ‘addCss’ and pass in an array with the key ‘stylesheet’ and the value of ‘css/styles.css’.
The problem with the above is that Magento kindly reads all the white space as well as the actual value that I want to pass into the function, meaning that the value passed into the function is actually ‘ css/styles.css’. When it comes to rendering the stylesheet, we get:
This, of course, will not load the css file.
The correct way (if you haven’t worked it out) is to not indent the values:
It may not be as readable to you or me, but Magento will now read the value correctly.
Magento sucks as it does not trim the values that are passed from the xml files into the called functions. As such, we need to enter the values inline with the parameter tags.