If I view a page in Theme A that uses the layout in sites/mysite/themes/theme_a/layouts/layout-a.tpl.php and if I then view the same page with Theme B it still uses the same template file even if there exist a template file in sites/mysite/themes/theme_b/layouts/layout-a.tpl.php. Same file name and folder, except in Theme B.

Is it possible to make it use the layout in Theme B if I view the page in that theme?

Comments

merlinofchaos’s picture

Rather than duplicate the layout, you would need, I think, to put the template file at the top level of theme B. That way it should automatically be picked up by the registry as a template file override, and thus be used in that theme. At least, that is how it *should* work.

jisuo’s picture

Hey,

The reason I want this to work is because I'm using the Domain Access module to select a different theme for a mobile sub domain. So on the mobile site I use the exact same content I just change the html for all the templates (along with other various changes to optimize it for the mobile phones).

I can override all the tpl-files for content types in each theme, by naming them the same, it works great. I thought I could override the Panelizer layouts the same way.

I should also say that I have plugins[panels][layouts] = layouts in my .info file.

When you say template file, do you mean the layout template or template.php?

Thanks!

merlinofchaos’s picture

I mean the layout template file.

jisuo’s picture

Hey,

I got sidetracked with other projects and never got around to try this. I just tried it and it didn't work.

Got any other ideas?

edit: do you think something could be made in THEME_preprocess_page(&$variables) {} or is that too late?

damienmckenna’s picture

Version: 7.x-2.0 » 7.x-3.x-dev
Issue summary: View changes
damienmckenna’s picture

BTW you might want to try moving the layout to a module, just in case the fact it was stored in a specific theme caused problems with it loading the way you wanted.