Hi !
I’m trying to apply the QuickTip “multiple blueprint - same templates” but i encounter some difficulties.
My /content/
folder contain two types of txt file :
- publication_hdr.txt
- publication_these.txt
- publication.txt (default value for fields shared by both)
This content is managed using blueprints/pages :
- publications.yml defined two templates into tabs :
- publication_hdr.yml
- publication_these.yml
About templating :
- (1) I want to display publications as a list of all (publication_hdr and publication_these) →
publications.php
- (2) I want to display both
publication_hdr
and publication_these
content using → publication.php
(1) works easily with page->children()
, but problem starts with (2)
To do (2) i wrote this plugin/publications-helpers/index.php
like the quicktip say :
<?php
Kirby::plugin('xxx/publications', [
'templates' => [
'publication_hdr' => __DIR__ . '/templates/publication.php',
'publication_these' => __DIR__ . '/templates/publication.php',
]
]);
That don’t work, without error, and my publication_hdr
and publication_these
are displayed using default.php
But i finally found the problem, but to better understand i post the problem here for others, because i found this point is not clear on the doc :
When i change the root directory by kirby()->root(‘templates’) insted of __DIR__
it works now
Kirby::plugin('xxx/publications', [
'templates' => [
'publication_hdr' => kirby()->root('templates') . '/publication.php',
'publication_these' => kirby()->root('templates') . '/publication.php',
]
]);
So, check your path 
This is a misunderstanding, the cookbook recipe is about registering templates in a plugin, which means that the templates also live in the plugin, not in the standard /site/templates
folder. It doesn’t really make sense to have a plugin that refers to stuff that is supposed to exist outside of the plugin folder.
The templates extension accepts an array of key/value pairs, where the key is the name of the template and the value the path to the file in your plugin folder:
Ok ! This is more clear @texnixe, i found strange the need to create a plugin to manage only this … This is some code i found on project on github, some i’m not alone to take the wrong path 
This is the only way ? If i need same behaviour, multiple blueprint and one controller/templates/etc, directly register templates into index.php ?
Yes, if you need the same template for pages with different “intendedTemplates” (i.e. content file names), that is the way forward.
The question is if you need different blueprints or if you could use conditional fields/fieldgrous/sections instead.
Yes you’re right @texnixe , this is related to my previous question on the forum.
I learn kirby by doing
, i first found this is more clear (in my head) to have different blueprints for my categories of publications. In the future perhaps we need more categories and i’m not a fan of conditionnal fields.
I have three tabs, one blueprint for each type of publications with potentially different fields.
Perhaps a simple query on publication.yml
blueprint, that create specific list of document based on each type listed into content/xxxx/publication.txt
files (Hdr, Theses, Others) is far more simpler … That remove the need of this plugin to display information.
Ok, then I’d just leave it as is. And if you don’t like the plugin (don’t understand why), then create those three different templates in /site/templates
, and use snippets for the parts that repeat.
Hi @texnixe thanks a lot for your support again 
This is because for me plugin is something more complex, that give new capacities to the core product, and not only some pages to register. But that’s ok, i will create this little plugin 