Hello Magento professionals.
I'm writing a custom module for magento and having some problems here.
My layout xml does not work.
First of all – caching is disabled, compilation is disabled, magento developer mode is enabled and logging is enabled.
Everything seems to be configured correctly, but I'm not even getting an exception or log.
My modules config.xml:
<?xml version="1.0"?>
<config>
<modules>
<Namespace_Module>
<version>1.1.0</version>
<depends>
<Mage_Catalog />
</depends>
</Namespace_Module>
</modules>
<global>
<helpers>
<module>
<class>Namespace_Module_Helper</class>
</module>
</helpers>
<models>
...
</models>
<blocks>
...
</blocks>
</global>
<frontend>
<routers>
<module>
<use>standard</use>
<args>
<module>Namespace_Module</module>
<frontName>module</frontName>
</args>
</module>
</routers>
<layout>
<updates>
<module>
<file>
module/module.xml
</file>
</module>
</updates>
</layout>
</frontend>
<admin>
<routers>
<adminhtml>
...
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<module>
<file>module.xml</file>
</module>
</updates>
</layout>
</adminhtml>
</config>
I just set "Namespace" and "Module" as placeholders for my custom namespace and custom module name.
In the layout xml for frontend I just put in some misconfigurations to see if it cause an error, but the xml file sees even not to be parsed. For example I put in <layout> </xxxlayout>
What's wrong with the configuration ?
The layout xml file is put under base/default/layout/module/module.xml
The admin layout which I configured in the same file works perfectly!
Best Answer
It could be a number of things (some that won't be debuggable since you altered your
config.xml
file before posting here), but one thing that pops out immediately is thisshould be this
For reasons myriad and complicated, Magento and PHP parse XML documents with white space being significant in text nodes. That means when the layout update XML parsing code gets to here
The
$filename
string it generates for your code will look likeThat is, with the big old hunk of whitespace in the middle. This path will not pass the
is_readable
check, so your layout file will be skipped.Remove the white space from your node and you'll have removed one potential problem.