1

I am a noob of Magento 1.9.

I have these custom module files:

app/code/local/mypackage/custommodule/block/mymodulename.php
app/code/local/mypackage/custommodule/etc/config.xml
app/code/local/mypackage/custommodule/templates/mymodulename.phtml
app/code/local/mypackage/custommodule/templates/mymodulename_1.phtml
app/code/local/mypackage/custommodule/templates/mymodulename_2.phtml

I've added some code to block/mymodulename.php and then I want to use that module in the homepage with the template called mymodulename_2.phtml.

mymodulename_1 is already working correctly elsewhere in my site but I don't know how (cause I'm noob).

This is the config.xml of the module:

<?xml version="1.0"?>
<config>
    <modules>
        <Mypackage_Custommodule>
            <version>1.0.0</version>
        </Mypackage_Custommodule>
    </modules>
    <global>
        <blocks>
            <mypackagecustommodule>
                <class>Mypackage_Custommodule_Block</class>
            </mypackagecustommodule>
        </blocks>
    </global>
</config>

I've tried to put the module in the homepage with

app/design/frontend/mytheme/mypackage/layout/local.xml

<cms_index_index>
    <reference name="content">
       <block type="mypackagecustommodule/mymodulename" name="mypackage_custommodule_mymodulename_2" template="mypackagecustommodule/mymodulename_2.phtml"/>
    </reference>
</cms_index_index>

The result is this and I don't know why it can't find the file:

File not found in /home/mypackage/mypackagemagento/app/code/core/Mage/Core/Block/Template.php

0 /home/mypackage/mypackagemagento/app/code/core/Mage/Core/Block/Template.php(241): mageCoreErrorHandler()

1 /home/mypackage/mypackagemagento/app/code/local/Mypackage/Custommodule/Block/mymodulename.php(29): Mage_Core_Block_Template->fetchView()

Thank you in advice.

1 Answer 1

0

all file is like

app/code/local/Mypackage/Custommodule/Block/Mymodulename.php
app/code/local/Mypackage/Custommodule/etc/config.xml
app/design/frontend/base/default/template/mypackagecustommodule/mymodulename.phtml
app/design/frontend/base/default/template/mypackagecustommodule/mymodulename_1.phtml
app/design/frontend/base/default/template/mypackagecustommodule/mymodulename_2.phtml

config.xml code

<?xml version="1.0"?>
<config>
    <modules>
        <Mypackage_Custommodule>
            <version>1.0.0</version>
        </Mypackage_Custommodule>
    </modules>
    <global>
        <blocks>
            <mypackagecustommodule>
                <class>Mypackage_Custommodule_Block</class>
            </mypackagecustommodule>
        </blocks>
    </global>
</config>

Mymodulename.php file code is like

class Mypackage_Custommodule_Block_Mymodulename extends Mage_Core_Block_Template
{

}

local.xml code

<cms_index_index>
    <reference name="content">
        <block type="mypackagecustommodule/mymodulename" name="mypackage_custommodule_mymodulename_2" template="mypackagecustommodule/mymodulename_2.phtml"/>
    </reference>
</cms_index_index>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.