I am new to Magento and have been trying to create a module, to display block content using getChildHtml(). However, it is not working.
In app/design/frontend/muster/default/template/page/html/header/header4.phtml, I have the following code:
<div class="grid_10 v-grid">
<?php echo $this->getChildHtml('userdropdown_menu_dropdown'); ?>
</div>
In app/design/frontend/muster/default/layout/muster/userdropdown.xml, I have the following structure:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="userdropdown.menu">
<block type="bb_userdropdown/userdropdown_menu_dropdown" name="userdropdown_menu_dropdown" as="userdropdown" template="muster/userdropdown/userdropdown/menu/dropdown.phtml"/>
</reference>
</default>
</layout>
In app/design/frontend/muster/default/template/muster/userdropdown/userdropdown/menu/dropdown.phtml, I have the following code:
<?php
$test = $this->helloWorld();
echo $test;
?>
In app/etc/modules I have created Muster_UserDropdown.xml, in which I have the following code:
<?xml version="1.0"?>
<config>
<modules>
<Muster_UserDropdown>
<active>true</active>
<codePool>community</codePool>
<version>0.1.0</version>
</Muster_UserDropdown>
</modules>
</config>
I have created the folder app/code/community/Muster/UserDropdown, which has the following subfolders:
Block
Helper
controllers
etc
sql
The following ones are empty:
Helper
Model
controllers
sql
Inside app/code/community/Muster/UserDropdown/Block, I have the following file:
app/code/community/Muster/UserDropdown/Block/Userdropdown/Menu/Dropdown.php
The code in app/code/community/Muster/UserDropdown/Block/Userdropdown/Menu/Dropdown.php is as follows:
<?php
class Muster_UserDropdown_Block_Userdropdown_Menu_Dropdown extends Mage_Core_Block_Template
{
/**
* TESTING
*/
public function helloWorld()
{
return 'Hello world!';
}
}
Inside app/code/community/Muster/UserDropdown/etc, I have the following file:
app/code/community/Muster/UserDropdown/etc/config.xml
The code in app/code/community/Muster/UserDropdown/etc/config.xml is as follows:
<?xml version="1.0"?>
<config>
<modules>
<Muster_UserDropdown>
<version>0.1.0</version>
</Muster_UserDropdown>
</modules>
<frontend>
<routers>
<bbuserdropdown>
<use>standard</use>
<args>
<module>Muster_UserDropdown</module>
<frontName>bbuserdropdown</frontName>
</args>
</bbuserdropdown>
</routers>
<translate>
<modules>
<bb_userdropdown>
<files>
<default>BB_UserDropdown.csv</default>
</files>
</bb_userdropdown>
</modules>
</translate>
<layout>
<updates>
<bb_punchcard>
<file>muster/userdropdown.xml</file>
</bb_punchcard>
</updates>
</layout>
</frontend>
</config>
What is wrong since getChildHtml('userdropdown_menu_dropdown') does not return anything?