Help with Child Templates

I’ve read the documentation but I’m not sure I understand the complete picture of what I need to do.

Currently, my site is using the bootstrap template.
I want to create a child template to override the header.

First question, is this the template I’m suppose to override?
/plugins/themes/bootstrap3/templates/frontend/components/header.tpl

From what I read, I simply create a corresponding template. Does that mean I would create a file such as?
/plugins/themes/mychildtemplates/templates/frontend/components/header.tpl

According to this doc:
https://pkp.gitbooks.io/pkp-theming-guide/content/en/child-themes.html
I’m supposed to create this php file. Where does this go?
Also, what do I put in the call to
$this->setParent(’???’)
I’m not override the “defaultthemeplugin”. I’m overriding the bootstrap plugin, so where do I find this parent name?

First question, is this the template I’m suppose to override? /plugins/themes/bootstrap3/templates/frontend/components/header.tpl

Yes.

From what I read, I simply create a corresponding template. Does that mean I would create a file such as? /plugins/themes/mychildtemplates/templates/frontend/components/header.tpl

Yep.

According to this doc:
https://pkp.gitbooks.io/pkp-theming-guide/content/en/child-themes.html2
I’m supposed to create this php file. Where does this go?

Check out the Theme Setup & Configuration section for details on all the other files you need to get your theme going as a plugin.

Also, what do I put in the call to
$this->setParent(‘???’)
I’m not override the “defaultthemeplugin”. I’m overriding the bootstrap plugin, so where do I find this parent name?

This should match the class name in the version.xml file, except in all lower-case letters: bootstrapthreethemeplugin.

Thanks @NateWr

I have done all this. Do I need to activate/select the new child theme somehow or will it automatically be picked up?

@NateWr you may have missed my last message, but please let me know what the final step is to enable the child template.

Thanks

Hi @inferlinkdev,

He’s currently on vacation but will return soon. Please be patient – we’re a small team with a lot of competing priorities!

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @inferlinkdev,

Yes, you should be able to enable the theme for selection by going to the Settings > Website > Plugins page, finding the theme plugin and making sure it’s enabled there.

Then you can select it as the active theme for a journal by going to Settings > Website > Appearance, finding the Theme option and setting it to your theme.

1 Like

Hi @NateWr

I’ve enabled it in the Plugins and got a pop-up saying it’s enabled.
(Currently, Default Theme and my custom theme are enabled. The Bootstrap 3 Base Theme is not checked actually.)

But under Settings > Website > Appearance, only the Bootstrap 3 Base Theme and Default Theme are available from the Theme dropdown.

I’m not sure why my custom theme (called Jair Theme) is not available under the drop down (but the Bootstrap 3 Base Theme is even though it’s not checked in the Plugins page)

I’d recommend checking the version.xml file and other things to make sure the configuration is set up properly. If you can share a repository with your theme’s code, I’m happy to take a look.

1 Like

Hi @NateWr,

Here is the repo of my child template:

Let me know what I need to change.

Kane

Hi Kane,

The <application> entry needs to match the directory name of your theme.

So this:

<application>jair-theme</application>

Should probably be this:

<application>ojs3-jair</application>

@NateWr

My custom theme is actually under /home/jair/ojs/plugins/themes/jair
So I modified the version.xml to
<application>jair</application>

This allow me to select the Theme from the dropdown.

HOWEVER, now my site has crashed!!!
I can’t get to the site any more: http://journals.sfu.ca/jair/index.php/jair
I can’t even manage the site: http://journals.sfu.ca/jair/index.php/jair/management/settings/website

Please HELP!!!

Hi @inferlinkdev,

That suggests you’ve got a fatal error in your theme code. You’ll need to investigate your server’s error log, find the error message, and figure out where your code is breaking. You should always be working on a development version of your site, as it’s quite common to have errors and you don’t want to be debugging them as you go on the live site.

Hi @inferlinkdev, James from PKP|PS here. You won’t be able to access the error log without sudo access, so what I’ve done instead to help is switch the “display_errors” parameter to “On” in your config.inc.php file. You’ll want to switch this to “Off” prior to launch. This will output any errors to the screen. What you see now is:

Fatal error: Call to undefined function setParent() in /mnt/u2/var/www/journals/jair/plugins/themes/jair/JairThemePlugin.inc.php on line 10

That should be enough to point you in the right direction, but just let us know if you have any follow-up questions. You can query the PS support team directly at pkp.contact@gmail.com for sensitive or technical issues (the forum is probably still the best place for theme-related queries though).

Cheers,
James

1 Like

Thanks @jmacgreg the logging was very helpful. Thanks for pointing that out.

Thanks @NateWr It’s all good now