0
votes

I have created three different modules for magento custom column layout, magento custom prices and magento custom file extension(this extension supposed to allow any video file) inside the code/local codepool folder.

I followed the folder structure of each module from the code/core codepool. However these modules are not recognized.

To test if my code is correct, I paste the magento custom column layout config.xml code to app/code/core/Mage/Page/etc to update it and it works.

Question: How can my code works in code/local codepool?

This is a portion of my working magento custom column layout config.xml file.

<layouts>
    <empty module="page" translate="label">
        <label>Empty</label>
        <template>page/empty.phtml</template>
        <layout_handle>page_empty</layout_handle>
    </empty>
    <one_column module="page" translate="label">
        <label>1 column</label>
        <template>page/1column.phtml</template>
        <layout_handle>page_one_column</layout_handle>
        <is_default>1</is_default>
    </one_column>
    <full_column module="page" translate="label">
        <label>Full 1 column</label>
        <template>page/full1column.phtml</template>
        <layout_handle>page_one_column_full</layout_handle>
        <is_default>1</is_default>
    </full_column>
    <two_columns_left module="page" translate="label">
        <label>2 columns with left bar</label>
        <template>page/2columns-left.phtml</template>
        <layout_handle>page_two_columns_left</layout_handle>
    </two_columns_left>
    <two_columns_right module="page" translate="label">
        <label>2 columns with right bar</label>
        <template>page/2columns-right.phtml</template>
        <layout_handle>page_two_columns_right</layout_handle>
    </two_columns_right>
    <three_columns module="page" translate="label">
        <label>3 columns</label>
        <template>page/3columns.phtml</template>
        <layout_handle>page_three_columns</layout_handle>
    </three_columns>
</layouts>

Thanks!

2
IIRC app/code/core/Mage/Page/etc/config.xml has special rules for processing, so you can not test it that way. In any case you should never change data in these core folders not even for testing. So I'd say it only makes a bad description for a magento question and is not helpful towards solving your issue.hakre
Any reason you don't consider etc/theme.xml for layout updates instead of ect/config.xml? Related: Layout updates in theme.xml (on the Magento Stackexchange site)hakre

2 Answers

2
votes

Config.xml is just the configuration file of your module and it's not intended for (direct) layout updates. For this purpose you have to create one config.xml file for each module and, in this files, create the XML instructions, through XML node "updates", that say to magento "this is the path for the layout file of this module":

...
<frontend>
    ...
    <layout>
        <updates>
            <(modulename)>
                <file>(name_of_layout_file.xml)</
            </(modulename)>
        </updates>
    </layout>
</frontend>

From: Frontend (Magento - Wiki - config.xml Reference)

Now, you have to create that file within the layout folder of your template, putting inside all the code you need to update the global layout.

More infos:

0
votes

Sorry it's been a while since I post this question. I have been in a vacation for the past weeks so I don't have time to visit this page.

I already figure out the solution for this kind of problem.

Every custom module that a developer will create should register it first to app/etc/modules folder.

Step 1: I followed the folder structure from the app/code/core and put it on the app/code/local. The structure goes like this app/code/local/Mage/Page/etc/config.xml

Step 2: To register my new modules. I Created an .xml file in app/etc/modules and name it any name I want.

Step 3: I open the .xml file I have created and add this piece of code

<?xml version="1.0"?>
<config>
        <modules>
            <Mage_Page><!-- <Mage_Page> tag came from two folders. Mage is my namespace from app/code/local/Mage and Page is my module name from app/code/local/Mage/Page. -->
                <active>true</active>
                <codePool>local</codePool>
            </Mage_Page>
        </modules>
</config>

Step 4: Save all the files you have created/updated.

Step 5: I refresh the admin page and checked if my work is working and yes it is working.

This took me a while due to lack of knowledge and experience in developing magento. But thanks for your help.

Thanks!