Magento 1.7: Issues Adding Custom CMS Page Templates?

Following the Magento Wiki, there is an excellent article on creating custom CMS pages.

However, twice this week we have heard on stack exchange (and from an intern) that following the article verbatim, their custom module and CMS pages were not appearing. The code looked fine copied and pasted in all cases, but their custom layouts were not appearing.

Here is an example from the wiki:
app/etc/modules/Fruit_Banana.xml

<?xml version="1.0"?>
    <config>
      <modules>
        <Fruit_Banana>
          <active>true</active>
          <codePool>local</codePool>
          <depends>
            <Mage_Page />
          </depends>
        </Fruit_Banana>
      </modules>
    </config>

This code will work great. The issue people were having is that they had space before the XML declaration. The XML declaration MUST be on the first line at the FIRST position. If you are having issues with your CMS page modules, this is likely the cause!

Example of a bad declaration:

	        <?xml version="1.0"?>
    <config>
      <modules>
        <Fruit_Banana>
          <active>true</active>
          <codePool>local</codePool>
          <depends>
            <Mage_Page />
          </depends>
        </Fruit_Banana>
      </modules>
    </config>

What is causing so many people to have issues with this is the fact that when copying XML from Magento’s Wiki, white space is added in front of every line, so a direct copy and paste will give you XML that cannot be parsed.

This entry was posted in E-Commerce and tagged . Bookmark the permalink.

One Response to Magento 1.7: Issues Adding Custom CMS Page Templates?

    Leave a Reply

    Your email address will not be published. Required fields are marked *