rax313
rax313

Reputation: 88

Creating Custom modules in Magento

I am new to magento and I wanted to try out creating custom modules. I am currently following this tutorial since I find it easy to follow, however I am encountering an error in testing if magento is really loading my config file.

instread of the "Controller file was loaded but class does not exist" I am still getting the page not found error.

Here is my app/etc/modules/CompanyName.xml

<?xml version="1.0"?>
<config>
     <modules>
        <CompanyName>
            <active>true</active>
            <codePool>local</codePool>
        </CompanyName>
     </modules>
</config>

And here is my app/local/CompanyName/Helloworld/etc/config.xml

    <?xml version="1.0"?>
    <config>
    <modules>
        <CompanyName_HelloWorld>
            <version>
                0.1.0
            </version>
        </CompanyName_HelloWorld>
    </modules>
<!-- ... -->
    <frontend>
        <routers>
            <!-- the <helloworld> tagname appears to be arbitrary, but by
            convention is should match the frontName tag below-->
            <helloworld>
                <use>standard</use>
                <args>
                    <module>CompanyName</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>
    </frontend>
<!-- ... -->

</config>

-edit- fixed error/warning logs

I looked at varien.php and remembered that the guide I followed told me to disable/comment out domain,secure,httponly. so I removed the comments and I am now not getting any warnings errors in the logs. But i still cannot make magento read my config file. =(

$cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()
        );

Clearing the cache fixed the SQL error but I still can't make magento load a helloworld custom module

this is frustrating.

Upvotes: 0

Views: 1027

Answers (2)

Needhi Agrawal
Needhi Agrawal

Reputation: 1326

The app/etc/modules/CompanyName.xml should rename as app/etc/modules/CompanyName_HelloWorld.xml and the XML should be changed to reflect the filename

<?xml version="1.0"?>
<config>
    <modules>
        <CompanyName_HelloWorld>
            <active>true</active>
            <codePool>local</codePool>
        </CompanyName_HelloWorld>
     </modules>
</config>

And the /app/code/local/CompanyName/HelloWorld/etc/config.xml should be:

<config> 
    <modules>
        <CompanyName_HelloWorld>
            <version>0.0.1</version>
        </CompanyName_HelloWorld>
    </modules>
     <frontend>
                <routers>
                    <helloworld>
                        <use>standard</use>
                        <args>
                              <module>CompanyName_HelloWorld</module>
                              <frontName>helloworld</frontName>
                        </args>
                    </helloworld>
                </routers>
     </frontend>
</config>

Upvotes: 0

CCBlackburn
CCBlackburn

Reputation: 1704

Ahhh, think I found it...I didn't see it before. The app/etc/modules/CompanyName.xml should actually be called app/etc/modules/CompanyName_HelloWorld.xml and the XML element after modules should be changed to reflect the filename

<?xml version="1.0"?>
<config>
    <modules>
        <CompanyName_HelloWorld>
            <active>true</active>
            <codePool>local</codePool>
        </CompanyName_HelloWorld>
     </modules>
</config>

Upvotes: 1

Related Questions