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

Adding a new layout template! 
 
Christopher Geary
Jr. Member
 
Total Posts:  15
Joined:  2010-06-12
 

Hi Guys,

I’m trying to add a new layout template to my magento store, i don\’t actually need one (I just think it could be beneficial in the future to know that I can do it).

I don’t want to be editing core files, and preferably don\’t want to do it via the app->etc->local.xml file as I\’m going to be moving this theme/template around to other stores.. I\’ve read that It should be set up as a separate module right, rather that putting it into the template files? Well this is what I have:

In app->etc->modules->CrGeary_TestTheme.xml

<?xml version="1.0"?>
<config>
    <
modules>
        <
CrGeary_TestTheme>
            <
active>true</active>
            <
codePool>local</codePool>
            <
depends>
                <
Mage_Core />
            </
depends>
        </
CrGeary_TestTheme>
    </
modules>
</
config>

Then in: app->code->local->CrGeary->TestTheme->etc->config.xml

<?xml version="1.0"?>
<config>
    <
modules>
        <
CrGeary_TestTheme>
            <
version>0.1.0</version>
        <
CrGeary_TestTheme>
    </
modules>
    <global>
        <
page>
            <
layouts>
                <
mytheme module="page" translate="label">
                    <
label>My Theme</label>
                    <
template>page/mytemplate.phtml</template>
                    <
layout_handle>page_mytheme</layout_handle>
                </
mytheme>
            </
layouts>
        </
page>
    </global>
</
config>

Can someone tell me where I\’m going wrong? I’ve cleared the cache, I’ve checked to make sure magento recognises the module, I’ve tried to follow about 6 different tutorials, all say that this is the way to do it. I’m just stuck now! :/

Thanks,
Chris

 
Magento Community Magento Community
Magento Community
Magento Community
 
MattStephens
Sr. Member
 
Avatar
Total Posts:  152
Joined:  2011-07-12
United Kingdom
 

Hi Chris

There is no need to create a new Module to simply apply a different theme (look and feel) to your website.

Instead you need to create a new theme. This tutorial should help point you in the right direction: http://www.magentocommerce.com/design_guide/articles/working-with-magento-themes

What you have done is on the road to creating a new page layout (1 column, 2 column etc), rather than say just changing the way the product detail page is output!

Cheers
Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christopher Geary
Jr. Member
 
Total Posts:  15
Joined:  2010-06-12
 

Hey, Thanks for the reply..

But that’s what I’m trying to do, I want to create multiple layouts (not just the standard 1, 2 & 3 column ones).. And you can’t (as far as I have read) do this without a module of some kind, and I don’t want to edit the core modules.

I’m fine with editing templates, and modifying local.xml in the layout files, I’ve set up my own package with a default theme in it which is all written in HTML 5. I’m also fine editing core files (but I don’t want to be editing them, I want to do it properly)

Ignore the naming of my files, TestTheme was just a name I came up with until I think of a proper name for the theme/template. I’m planning to add a “theme options page” by using a module, this same module will have additional page layouts.

Sorry for my constant use of the word “theme”, I’m used to WordPress..

Thanks again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christopher Geary
Jr. Member
 
Total Posts:  15
Joined:  2010-06-12
 

I’ve managed to get it to work by taking out the “<modules>” tag and its content, I don’t know why it works without it, and not with it? Seems strange? Anyone know the reason for it?

<?xml version="1.0"?>
<config>
    <global>
        <
page>
            <
layouts>
                <
mytheme module="page" translate="label">
                    <
label>My Theme</label>
                    <
template>page/mytemplate.phtml</template>
                    <
layout_handle>page_mytheme</layout_handle>
                </
mytheme>
            </
layouts>
        </
page>
    </global>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre Michalet
Member
 
Total Posts:  50
Joined:  2010-09-01
Grenoble, France
 

You will clearly not like that but I think there’s a XML mistake on the ending tag of CrGeary_TestTheme ...

PHP should have notified you about that but maybe you disabled the display_errors setting

 
Magento Community Magento Community
Magento Community
Magento Community
 
Christopher Geary
Jr. Member
 
Total Posts:  15
Joined:  2010-06-12
 
Pierre Michalet - 14 April 2012 11:14 PM

You will clearly not like that but I think there’s a XML mistake on the ending tag of CrGeary_TestTheme ...

Wow, I can’t believe I missed that, I read through my code so many times as well.. Thanks very much for pointing it out! It works!! smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top