Can't override header.tpl template

I was trying to create a custom theme but i can’t override the header template.
i even tried to install the Bootstrap3 theme but the theme styles was missed up i checked it out in the browser inspect and i found that the default header is the one loaded not the bootstrap custom header.

can any one please tell me what’s wrong?

Hi @wpguru,

I see you’ve also posted this over at Header.tpl is not loading · Issue #120 · NateWr/bootstrap3 · GitHub – please just post to one place; you’ll reach the team either way.

I presume you’re asking about OJS; what version are you using? (Please include this in your posts.)

How did you install the Bootstrap3 plugin?

Regards,
Alec Smecher
Public Knowledge Project Team

I’m using OJS 3 the latest version,
i’m not asking about the Bootstrap3 theme i’m just saying the header.tpl can’t be overridden i’m trying to build a custom theme but i can’t override the header template.
i thought i might have done something wrong but when i installed the bootstrap3 theme and saw that it’s also not working i asked the question.

Hi @wpguru,

Presumably you’re using an existing theme plugin as a template for your custom theme, though – if we’re able to figure out what’s happening with Bootstrap3, then maybe the same solution will apply to your custom theme. However, I can’t comment on code I don’t know, so it’ll be easier to debug Bootstrap3. If you can let me know what exact version of OJS you’re using, and how you installed the Bootstrap3 plugin, I can maybe suggest some places to look.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
I’m using OJS v 3.1.2 but i have just checked a thread here Custom theme not work on OJS 3.1.2 · Issue #4600 · pkp/pkp-lib · GitHub that have the same problem
and it turned out the error is in the OJS itself, it looks like there’s a line missing in the Plugins.inc.config class which prevents it from resolving the overrides on windows
https://github.com/pkp/pkp-lib/blob/master/classes/plugins/Plugin.inc.php#L389

i have changed it and it worked

Hi @wpguru,

That fix is included in the OJS 3.1.2-1 release, which was published yesterday.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

We had the same problem when tried to test the new version, the override for header and footer was solve but still have some issues.

Each one of our journals use a different way to show the language selector so we modified the block.tpl replacing the code by this line {include file=“frontend/components/language.tpl”} for manage the custom view in each template.
Running OJS 3.1.2-1 (latest version), I dont know why but it takes one of this files for cache and doesn’t read the others files, this happend switching between the journals.

I attach some captures of how it should look although it only shows the first style it reads. The captures correspond to the templates working in 3.1.1-2.

17
34
57

Regards

Hi @madileweb,

Can you double-check your version? There is no OJS 3.1.1.2-1.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher I’m sorry. OJS 3.1.2-1.

Hi @madileweb,

Where do the templates for each journal live? Are these e.g. built into theme plugins?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Each journal has a custom template plugin based on Default Manuscript. So, I replace, on languageToggle plugin in block.tpl, the code for an include ( - {include file=“frontend/components/language.tpl”} - ) and the routes for override each custom language.tpl are:

plugins/themes/saludColectiva/templates/frontend/components/language.tpl
plugins/themes/epistemologia/templates/frontend/components/language.tpl
plugins/themes/perspectivas/templates/frontend/components/language.tpl

This is working on production now with OJS 3.1.1-2 - http://revistas.unla.edu.ar

But, when I migrated to OJS 3.1.2-1, it did a cache from one of three templates but shows the same in all jornals.

Regards,
Diego

Hi @madileweb,

I did a quick test with OJS 3.1.2-1 and it behaves as expected (two journals, each with its own theme based on default manuscript, and an include as you specify above). Is it possible that your adaptation of the theme for each journal is incomplete, i.e. some references to defaultManuscript exist in the themes derived from it? Check e.g. version.xml and the theme classes for possible cases.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

We have solved the issue but not in the same way. Finally, we carry out the different customizations within the same block.tpl file using if, elseif, else to decide which journal corresponds. Even so, the previous way of customizing the language module by an - include - to an the specific file worked well in the previous version, although it is not clear because it does not do it in the latest version, it can be a modification of Smarty 3. It is not the solution, but it is an alternative that works.

Regards,
Diego

Hi @madileweb,

I’m glad you’ve worked around the issue, but I think I liked your previous approach’s portability better. Unfortunately I haven’t been able to replicate the problem. I’ll talk it over with the devs and see if anything rings a bell for them.

Thanks,
Alec Smecher
Public Knowledge Project Team

1 Like

There were changes introduced into templates overriding but as I see they were not ported into OJS 3.1.2-1 release. Correspondent issue: Overridden plugin templates in theme not shown in child theme · Issue #4054 · pkp/pkp-lib · GitHub and PR: pkp/pkp-lib#4054 recursive check for templates of ancestors by Vitaliy-1 · Pull Request #4710 · pkp/pkp-lib · GitHub

But this particular problem looks different. The problem was that overriding wasn’t working at all for child themes.

Hi @Vitaliy thanks for answer. If you need more information about it don’t hesitate to request.

Regards,
Diego