Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Creating a Magento Module For The First Time - Won’t Load My Layout XML File
 
Borduhh
Member
 
Avatar
Total Posts:  40
Joined:  2010-09-14
Rochester, NY
 

Hey Everyone,

So I am creating my very first Magento Module, but for some reason it will not load the layout XML from the app/design/frontend/base/default/layout folder. Here is the code I have so far:

app/code/community/BorduhhLabs/CartDropDownMenu/etc/config.xml

<config>
    <
modules>
        <
BorduhhLabs_CartDropdownMenu>
            <
version>1.0</version>
        </
BorduhhLabs_CartDropdownMenu>
    </
modules>
    <global>
        <
blocks>
            <
borduhhlabs_cartdropdownmenu>
                <class>
BorduhhLabs_CartDropdownMenu_Block</class>
            </
borduhhlabs_cartdropdownmenu>
        </
blocks>
    </global>
    <
frontend>
        <
layout>
            <
updates>
                <
borduhhlabs_cartdropdownmenu>
                    <
file>BorduhhLabs_CartDropdownMenu.xml</file>
                </
borduhhlabs_cartdropdownmenu>
            </
updates>
        </
layout>
    </
frontend>
</
config>

app/etc/modules/BorduhhLabs_CartDropDownMenu.xml

<config>
    <
modules>
        <
BorduhhLabs_CartDropdownMenu>
            <
active>true</active>
            <
codePool>community</codePool>
        </
BorduhhLabs_CartDropdownMenu>
    </
modules>
</
config>

app/code/community/BorduhhLabs/CartDropdownMenu/Block/cartDropdownMenu.php

<?php

class BorduhhLabs_CartDropdownMenu_Block_Menu extends Mage_Core_Block_Template 
{    
    
}

?>

app/design/frontend/base/default/layout/BorduhhLabs_CartDropdownMenu.xml

<layout version="0.1.0">
    <default>
        <
reference name="head">
            <
action method="addCss"><stylesheet>css/BorduhhLabs/cartDropDownMenu.css</stylesheet></action>
        </
reference>
            
        <
reference name="header">
            <
block type="borduhhlabscardropdownmenu/menu" name="cartDropdownMenu" template="BorduhhLabs/cartDropdownMenu.phtml">
        </
reference>
    </default>
</
layout>

From here I know there is a problem because the CSS file I have specified here does not get called in the head of the HTML document. Any suggestions on what I might be doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoMageTeam
Guru
 
Avatar
Total Posts:  356
Joined:  2013-01-13
Warsaw, Poland
 

Hello,

The paths are case sensitive, so you need to indicate the classes and files names in the configurable files in the same case as you have in the system. Other words, the section:

<modules>
        <
BorduhhLabs_CartDropdownMenu>
            <
version>1.0</version>
        </
BorduhhLabs_CartDropdownMenu>
    </
modules>

Should be:

<modules>
        <
BorduhhLabs_CartDropDownMenu>
            <
version>1.0</version>
        </
BorduhhLabs_CartDropDownMenu>
    </
modules>
And it should look like this in all the files of the module. Most likely, Magento has not hooked up your module. There is the same error in your file app/etc/modules/BorduhhLabs_CartDropDownMenu.xml
Also you have the error in the layout.  The next code:
<reference name="header">
            <
block type="borduhhlabscardropdownmenu/menu" name="cartDropdownMenu" template="BorduhhLabs/cartDropdownMenu.phtml">
        </
reference>
Should be:
<reference name="header">
            <
block type="borduhhlabs_cartdropdownmenu/menu" name="cartDropdownMenu" template="BorduhhLabs/cartDropdownMenu.phtml">
        </
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top