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

Layout and Template Files in Custom Module Path (not in /app/design/)? 
 
harkman
Member
 
Avatar
Total Posts:  60
Joined:  2008-01-06
Ravensburg, Germany
 

Hello.

I noticed that (all?) tutorials in the wiki and forum always store their custom module layouts and templates in /app/design/adminhtml/default/default/
I do not like this very much and would prefer to separate those files from the default magento installation.
Is there a way to put the layout and template files in my custom module directory under /app/code/local/<Namespace>/<Module>/?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MA_19
Member
 
Total Posts:  41
Joined:  2009-01-21
 

Hi There,

I don’t think Magento supports templates in the app/code/ folders. This would be inconsistant with how templates are referenced, as the template paths are written relative to “app/design/adminhtml/default/default/”

Besides, your templates are already separated from the default Magento installation by being in the app/design/adminhtml/default/default/ModuleName folder aren’t they?

I have heard people suggest that module templates are kept in the /app/code/local/<Namespace>/<Module>/design folder and copied into the app/design/ folder upon installation - which is another strategy you might try.

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
harkman
Member
 
Avatar
Total Posts:  60
Joined:  2008-01-06
Ravensburg, Germany
 
MA_19 - 22 January 2009 06:53 AM

Hi There,
Besides, your templates are already separated from the default Magento installation by being in the app/design/adminhtml/default/default/ModuleName folder aren’t they?

There is something not ok with this approach. I’m sure there will be some other Admin templates in the future that improve the workflow here and there. If you install that my modules template files will not be loaded any longer because the path then will look like something similar to app/design/adminhtml/default/improvedDefault. Switching the Admin template will stop my module working.
Right?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MA_19
Member
 
Total Posts:  41
Joined:  2009-01-21
 
harkman - 28 January 2009 05:41 AM

There is something not ok with this approach. I’m sure there will be some other Admin templates in the future that improve the workflow here and there. If you install that my modules template files will not be loaded any longer because the path then will look like something similar to app/design/adminhtml/default/improvedDefault. Switching the Admin template will stop my module working.
Right?

I think you are confusing admin themes and admin modules.

Magento Wiki -

...Let’s go ahead and examine the two directories.
At first blush you’ll notice the use of directory names “default/default” in both directories like so:

Directory 1: app/design/frontend/*1/*2/
Directory 2: skin/frontend/*1/*2/

In both cases, *1 indicates the interface name, and *2 indicates the theme name. So if you were working on a theme called “my_theme” in an interface called “my_interface”, you would be working in the ‘app/design/frontend/my_interface/my_theme/’ directory.

(I had to modify the text a little to make it make sense without colours)
working-with-magento-themes

Thus:

Your stuff: app/design/adminhtml/default/default/yourmodule/
The new module stuff: app/design/adminhtml/default/default/newmodule/

both will quite happily co-exist in the default theme. you would only loose your own templates if you changed theme.

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
harkman
Member
 
Avatar
Total Posts:  60
Joined:  2008-01-06
Ravensburg, Germany
 
MA_19 - 28 January 2009 06:12 AM

Thus:

Your stuff: app/design/adminhtml/default/default/yourmodule/
The new module stuff: app/design/adminhtml/default/default/newmodule/

both will quite happily co-exist in the default theme. you would only loose your own templates if you changed theme.

Matt

Don’t get me wrong. I was not talking about a new module. I was talking about a non-default “Interface” with a own default “Theme” referenced by a path like
app/design/adminhtml/new_inteface/default

As far as I understand the documentation Magento will load app/design/adminhtml/default/default/ anyway if the required files are not available in the new_interface directory. That would answer my question. My modules design/template files will always be loaded from default/default even if a new interface is installed. (I will have to test if this really works.)
Even if I don’t like this spreading of files over the system - I can live with it wink

Thank you for the clarification.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre SII
Jr. Member
 
Total Posts:  25
Joined:  2008-12-19
Nice, France
 

If I well understood your confusing discussion, your answer is here: http://www.magentocommerce.com/wiki/changing_the_adminhtml_template

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre SII
Jr. Member
 
Total Posts:  25
Joined:  2008-12-19
Nice, France
 

Even better: http://www.magentocommerce.com/boards/viewthread/835/#t7266

 
Magento Community Magento Community
Magento Community
Magento Community
 
harkman
Member
 
Avatar
Total Posts:  60
Joined:  2008-01-06
Ravensburg, Germany
 

Thank you for the links.

But the discussion was not about how to switch adminhtml theme but how to write plugins that add theme elements to the core. And how to do this in a way that will be upgradeable and compatible to a future theme switch.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre SII
Jr. Member
 
Total Posts:  25
Joined:  2008-12-19
Nice, France
 

Ho! ok I get it now…

Sorry for the wrong posts…

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