3

On our site we have a default custom template that we use for almost all pages expert a few special admin pages.

One of the these pages is from the menu item pointed to the protostar template with menu id = 9 but when loading the page it loads our default template with id = 10.

Because of that the page breaks and prevents us from using that page. For some users the page still works and loads the correct template.

This only happens when the user is logged in, but since these pages is only available for administrators we have a big problem.

Any insight why this might happen? Also where is the file where Joomla decides what template to render?

1 Answer 1

3

The code where the template is chosen is the getTemplate function at \libraries\cms\application\site.php

The ID of the template should be saved next to the menu item in the template_style_id field of the __menu table of the database.

Basically, templates are linked to menu items. If a menu item is not present, it will fallback to the default one, so as long as your page has a menu item (as opposed to being called via parameters sent in the URL), then it should be working.

I'd probably first look in the database to make sure the right ID is next to the appropriate menu item.

You don't say what the logged in page does, but if it is a bespoke component, is there any chance it is setting the template programatically and bypassing the core functionality?

Also, there are extensions which allow you to set a different template for different user groups, which is the sort of thing which could also be overriding the expected behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.