# Include template into template

**URL:** <https://forum.getkirby.com/t/include-template-into-template/2723>\
**Category:** Questions\
**Tags:** v2\
**Created:** [December 4, 2015, 12:05pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723 "2015-12-04T12:05:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perry](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/perry/32/1336_2.png) [@Perry](https://forum.getkirby.com/u/Perry)\
**Post date:** [December 4, 2015, 12:05pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/1 "2015-12-04T12:05:43Z")

</div>

hello,

how can include a template into a template?

greetings perry

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 4, 2015, 12:11pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/2 "2015-12-04T12:11:37Z")

</div>

Why do you want to include a template within a template? You can include [snippets](http://getkirby.com/docs/templates/snippets):

```php
<?php snippet('my snippet') ?>

```

---

<div class="post-metadata">

**Author:** ![Perry](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/perry/32/1336_2.png) [@Perry](https://forum.getkirby.com/u/Perry)\
**Post date:** [December 4, 2015, 12:16pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/3 "2015-12-04T12:16:27Z")

</div>

try to change the template from the panel

```
  <?php $template = $page->vorlage()->kirbytext();  

  echo $template;

  if ($template == 'vorlage_a')
  
    {
      include('templat_a')

    }

  else
    {
      ......
    }

  ?>
```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 4, 2015, 12:19pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/4 "2015-12-04T12:19:05Z")

</div>

What I would do: Use one template with just a header and footer, and then include a different snippet depending on page settings. Or if the header and footer need to be different as well, call all snippets depending on that condition.

---

<div class="post-metadata">

**Author:** ![Perry](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/perry/32/1336_2.png) [@Perry](https://forum.getkirby.com/u/Perry)\
**Post date:** [December 4, 2015, 12:26pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/5 "2015-12-04T12:26:23Z")

</div>

Okay thank’s

* * *

select,blueprint

How can set a pre-select option?

```auto
  vorlage:
    label: Template
    type: select
    options: 
      template_a: 
        fr: template_a
        de: template_a
      template_b: 
        fr: template_b
        de: template_b

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 4, 2015, 12:29pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/6 "2015-12-04T12:29:30Z")

</div>

use default:

```nohighlight
vorlage:
  label: Template
  type: select
  default: template_a
  options: 
    ....

```

---

<div class="post-metadata">

**Author:** ![Perry](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/perry/32/1336_2.png) [@Perry](https://forum.getkirby.com/u/Perry)\
**Post date:** [December 4, 2015, 12:33pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/7 "2015-12-04T12:33:03Z")

</div>

* * *

thank you _texnixe_

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:04pm UTC](https://forum.getkirby.com/t/include-template-into-template/2723/8 "2025-02-06T17:04:04Z")

</div>

Archived on February 6, 2025, 5:04pm UTC


