Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Set another main template


7 Posts   946 Views


21 July 2010 at 3:20am Community Member, 37 Posts

Normally I create a new ExamplePage extends Page to use templates/ as another main template.
But for my module I need one main template for all classes (not the default So I added a page type and its template. Every class extends this new page class, but no class use the template... any idea?
Also another in my module templates folder doesn't work.


21 July 2010 at 3:49am 4085 Posts

This is the way the logic works for template selection:

Select main template for ClassName:

- Does theme_dir/templates/ exist?
- No? Is there a module where templates/ is defined?
- No? Try again with parent of (e.g.

Select layout template for ClassName:

- Does theme_dir/templates/Layout/ exist?
- No? Is there a module with templates/Layout/ defined?
- No? Try again with parent of (e.g.

Therefore, if you have a class SomePage extends Page, and you've defined /your_theme/templates/, it will use the main template

It SomePage extends ParentPage, and does not exist, it will look for If that doesn't exist, it will fall back on The same logic applies to the main template as it does the Layout template.


21 July 2010 at 4:17am Community Member, 37 Posts

Yes, I thought this is the way it goes, but not for me?!
for example we have
- module/code/ClassName.php <- extends Page
- module/code/ClassChildName.php <- extends ClassName

I have a
- theme_dir/templates/
and a
- module_dir/templates/

ClassChildName isn't a subclass in the sitetree... is this a problem? I don't think so

An existing page of type ClassName is displayed by but not its class children like ClassChildName.

mhm what could it be...


21 July 2010 at 5:10am 4085 Posts

So instead of displaying, what is?


21 July 2010 at 7:41am (Last edited: 21 July 2010 7:44am), Community Member, 37 Posts of course. there is no, otherwise it would use it, but the next template has to be, but it uses


22 July 2010 at 2:54pm 4085 Posts

You might try ?debug_request=1 to get a peek at what is going on inside the template selection process.


22 July 2010 at 6:32pm Community Member, 37 Posts

thx, I didn't know this debug param to display the process.
OK I translate it into our example:
here it goes for ChildClassName extends ClassName and ChildClassName is a subclass in sitetree of OtherClass

Debug line for SSViewer says:
Selecting templates from the following list: ChildClassName, OtherClass, Page, ContentController

What about ClassName?