Use two or more default templates

template

#1

Good evening

I renew Kirby setup and try to build a website with blog and knowledge base. Therefore I start with the baseblog theme and try to integrate the knowledge base theme.

What will be the best way to do this in general?

On my way I built the base structure and modified some little things in the baseblog - it works. Not as fast as I wanted, because of my tiny PHP knowledge. I have a Java background and have to study the docs a lot.

My idea was to put the content of the knowledge base into the content folder and take all the things described in the Readme.md file.

If you want to install this theme on an existing Kirby installation, copy these folders:

  • /assets
  • /site/blueprints
  • /site/controllers
  • /site/snippets
  • /site/templates

Therefore I renamed a couple of files and put the new names where it is needed. This works, I used MAMP and two different folders for the development. One for the baseblog and one for the knowledge base. Later on, I will transfer the knowledge base folder into a subfolder of the baseblog.

Now I have prepared everything except the default.php. The content of it for both themes is different and I don’t have an idea how to solve this problem. Is it possible to use a different default.php file for each theme?

Is there a solution I don’t understand at the moment?

Any hints or advice how to solve this?

Thank you.


#2

As far as I can see, in the Baseblog theme, only the error page uses the default template, all other pages have dedicated templates. Don’t know about the other theme, maybe if you provide a link to it, it’s easier to say, I don’t want to google this.

You could provide a dedicated template for the error page, then you could I think safely delete the default template of the Baseblog theme. There can be only one default.php file in the template folder, otherwise one would overwrite the other.


#3

Hello @texnixe

Thanks for your answer.

The baseblog can be found here: https://baseblog.sashtown.de

It is this one: https://github.com/christianreber/kirbycms-knowledge-base

I renamed it and copied the other one. It works for the moment.

I understood. To avoid this, do I have to make a new one and rename all files which has to use the template with it’s name? Am I right?


#4

You can make dedicated templates for each page or you can use the same template for multiple pages, depending on their content and how you want to display the stuff in it. Yes, the name of the content file (example.txt) defines what template a page is going to use (example.php). Only if there is no dedicated template with the name of the text file, does Kirby fall back to the default template.


#5

Got it. I think it will be useful to make a knowledge template and use subfolders there, like it is done in the original template. I will loose a clear file name, but win a not overloaded template folder and the default template for the rest of my site. Am I right?

Appreciate your help. Thank you.