Menu override doesn't work, {include file=""} seems not work on custom theme

Hi everyone,

I developed a theme for a journal that works fine on my OJS installation but when I install on client server, file includes overriding (include file="") seems not work and I can’t find the reason.

Header and footer tpl files are always lodaded from OJS template, ignoring custom frontend/components/header.tpl and frontend/components/footer.tpl on theme folder. There is no error on path or filename on the theme, because it works fine on my OJS installation.

If I change the path of {include file="frontend/components/header.tpl"} to {include file="frontend/gdComponents/header.tpl"}, for example, custom header loads correctly, but
menus keep loading tpl structure from navigationMenu.tpl. Even if I create custom position names on theme config file ($this->addMenuArea(array('position1', 'position2', 'position3', 'position4'));), default OJS navigationMenu.tpl keeps loaded.

This behavior happen only on client OJS installation.

Both servers uses:

  • PHP 7.4
  • Linux
  • OJS 33014 version
  • No php error log are generated
  • PHP extensions in use are very similar

Is there any directive on config.inc.php that could explain this behavior? Should be any php extension causing it? How OJS manages this includes? @asmecher @NateWr

Client reported that the OJS code didn’t receive any customization and that other installed themes showed atypical behavior as well. Maybe the cause can be some server config, but I don’t know were to looking for.

Hope I was clear on explanation.

Thank you

Hi,
(post edited)
did you derive your theme from the default theme? Usually, in this case, it just is sufficient to create a templates folder (with the same directory structure as with {ojs_root}/templates within the plugin and copy all the Smarty templates there and modify them).
Are the permissions of the files correct so that Apache can read them?

Hi @mpbraendle

All mentioned files are on theme folder and were modified but don’t load.

theme_folder/templates/frontend/components/header.tpl
theme_folder/templates/frontend/components/footer.tpl
theme_folder/templates/frontend/components/navigationMenu.tpl
theme_folder/templates/frontend/components/primaryNavMenu.tpl

Theme works fine on an OJS installation but not on another. I can’t find the reason because no error is registered and I don’t know if the reason is on OJS installation or on the server.

I believe theme itself has no issue.

Sorry, edited my previous post after fully having understood your problem.
Are the permissions of the files correct so that Apache can read them? Maybe, if it can’t read, it falls back to the default templates folder?

Ok @mpbraendle , no problem.

I have checked permissions and seems all good. Folders 755 and files 644.