user1559590
user1559590

Reputation:

Magento community extensions : should we use base theme directory?

When developing a module that will be reused outwith the scope of any one particular project i.e. using the community code pool, should I use the base theme to store my template, layout and skin files?

I am almost 100% certain that i should, but i see so many community modules using the default skin and theme directories that it has planted a tiny seed of doubt.

Upvotes: 3

Views: 1579

Answers (3)

Drew Hunter
Drew Hunter

Reputation: 10114

Yes, you should absolutely be using base/default for your community modules theme - in doing so you are utilising the fallback hierarchy Magento provides, allowing your theme to be portable and easy to extend by clients wishing to do so.

Upvotes: 6

Daniel Sloof
Daniel Sloof

Reputation: 12706

I'm not expecting upvotes for this answer, but would like to clarify on Tim and Drew's answers:

Unfortunately at the moment Magento only provides us with 3 levels of fall-back:

  • base/default
  • current_package/default
  • current_package/current_theme

Because 'current_package' is 'default' on standard Magento installations, you will often see extension developers place their files in 'default/default'. That is poor decision-making as it will mean the files will no longer be found when a non-default package is specified.

Obviously placing files in 'base/default' is also not the most optimal place, because in a sense you are removing the distinction between core and 3rd-party files. As others have mentioned, right now it is the only way of reliably adding your files while still allowing fallback to take place.

Fortunately, this will not be an issue in Magento 2, as these files will be part of modules instead, allowing pretty much infinite fallback.

Upvotes: 6

Tim Bezhashvyly
Tim Bezhashvyly

Reputation: 9100

Yes. Best practice is to create

app/design/frontend/base/default/template/your_extension_dir/

and

app/design/frontend/base/default/layout/your_extension_dir/

and put your files there.

Upvotes: 4

Related Questions