# Plugin Einkaufsweltelement Include in Template - Wie?

**URL:** <https://forum.shopware.com/t/plugin-einkaufsweltelement-include-in-template-wie/57061>\
**Category:** Programmierung\
**Created:** [13. Dezember 2018 um 15:25 UTC](https://forum.shopware.com/t/plugin-einkaufsweltelement-include-in-template-wie/57061 "2018-12-13T15:25:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FloC3](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FloC3](https://forum.shopware.com/u/FloC3)\
**Post date:** [13. Dezember 2018 um 15:25 UTC](https://forum.shopware.com/t/plugin-einkaufsweltelement-include-in-template-wie/57061/1 "2018-12-13T15:25:24Z")

</div>

Hallo,

mein Plugin erzeugt ein Einkaufsweltelement.

Im Plugin adde ich den Templateordner

```
$view->addTemplateDir( __DIR__. '/../Resources/Views/emotion_components/');

```

darin befindet sich meine Templatedatei unter folgendem Pfad:

```
widgets/emotion/components/mycomponent.tpl

```

der Inhalt wird auch sauber im Shopfrontend angezeigt.

Ich möchte jetzt aber den Inhalt in eine Datei auslagern, um sie auch an anderen Orten nutzen zu können.

Das&nbsp;Include-File&nbsp;soll&nbsp;hier liegen

```
frontend/_includes/myinclude.tpl

```

in meinem Einkaufsweltelement schreibe ich also

```
{include file="frontend/_includes/myinclude.tpl"}

```

und habe auch im Plugin selbst schon den Templateordner hinzugefügt

```
$view->addTemplateDir( __DIR__. '/../Resources/Views/frontend/');

```

&nbsp;

ich erhalte folgende Fehlermeldung in meiner Einkaufswelt und weiß nicht, was ich noch tun sollte. Offenbar wird mein Include-File nicht gefunden

```
Fatal error: Uncaught SmartyException: Unable to load template snippet 'frontend/_includes/myinclude.tpl' in 'widgets/emotion/components/mycomponent.tpl' in /xxx/xxx/shopware/engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php:127 Stack trace: #0 /xxx/xxx/shopware/engine/Library/Smarty/sysplugins/smarty_internal_template.php(286): Smarty_Internal_TemplateBase->fetch(Object(Enlight_Template_Default), NULL, NULL, NULL, false, false, true) #1 /xxx/xxx/shopware/var/cache/production_201812030839/templates/frontend_Responsive_de_DE_1_secure/55/cd/9e/55cd9ec8fcf9ee9813743411cab55e18d34bb371.snippet.mycomponent.tpl.php(24): Smarty_Internal_Template->getSubTemplate('frontend/_inclu...', NULL, 'frontend_Respon...', NULL, NULL, Array, 0) #2 /xxx/xxx/shopware/engine/Library/Smarty/sysplu in /xxx/xxx/shopware/engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php on line 127

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![h\_lohaus](https://avatars.discourse-cdn.com/v4/letter/h/a587f6/32.png) [@h\_lohaus](https://forum.shopware.com/u/h_lohaus)\
**Post date:** [13. Dezember 2018 um 16:09 UTC](https://forum.shopware.com/t/plugin-einkaufsweltelement-include-in-template-wie/57061/2 "2018-12-13T16:09:30Z")

</div>

```
$view->addTemplateDir( __DIR__. '/../Resources/Views/');

```

Vielleicht ohne frontend.
