# Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template snippet'

**URL:** <https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087>\
**Category:** Plugins\
**Created:** [24. Juli 2017 um 12:56 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087 "2017-07-24T12:56:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonali123](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sonali123](https://forum.shopware.com/u/sonali123)\
**Post date:** [24. Juli 2017 um 12:56 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/1 "2017-07-24T12:56:39Z")

</div>

Hello,

I’ve made one plugin for shop ware backend, but when I open it from backend it shows me error as below:

**Unable to load template snippet ‚backend/tackenberg\_pets/app.js‘ in engine/Library/Smarty/sysplugins/smarty\_internal\_templatebase.php on line 127**

Can you please help me to get rid of it?

Please find attached snap here with.

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/3/30b0790a2759e68f0dc4ee83c9a53acea4c7e722.png)

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [24. Juli 2017 um 13:14 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/2 "2017-07-24T13:14:52Z")

</div>

Hey,

this means that Shopware is not able to find your template files. Shopware does not know that you have custom template files in your plugin. For that you need to call a method named addTemplateDir(). This is possible in different ways, so depending on the plugin system you use und where in your plugin the template directory has to be added, the calling is slightly different.&nbsp;  
For more help, it would be nice if you could provide your plugin structure

Best regards from Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![sonali123](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sonali123](https://forum.shopware.com/u/sonali123)\
**Post date:** [25. Juli 2017 um 05:31 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/3 "2017-07-25T05:31:23Z")

</div>

Hello,

Thank you for the quick reply.

How can i share plugin structure ?

&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [25. Juli 2017 um 06:36 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/4 "2017-07-25T06:36:39Z")

</div>

Hey,

just upload a screenshot of your directory structure with all files. Another info we need is, do you use the new or the old plugin system?&nbsp;

Best regards from Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![sonali123](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sonali123](https://forum.shopware.com/u/sonali123)\
**Post date:** [25. Juli 2017 um 08:02 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/5 "2017-07-25T08:02:21Z")

</div>

This is the screenshop of my plugin structure:

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/5/5102cae3ec24196fae185a4f46e6b7f407416b18.png)

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [25. Juli 2017 um 08:51 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/6 "2017-07-25T08:51:34Z")

</div>

ok, please copy the code of your TackenbergPets/TackenbergPets.php and of&nbsp;TackenbergPets/Controllers/BackendTackenbergPets.php

---

<div class="post-metadata">

**Author:** ![sonali123](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sonali123](https://forum.shopware.com/u/sonali123)\
**Post date:** [28. Juli 2017 um 06:43 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/7 "2017-07-28T06:43:55Z")

</div>

I got the anser finally. I put the code in&nbsp;TackenbergPets/TackenbergPets.php file.

&nbsp;

&nbsp; &nbsp;public static function getSubscribedEvents()  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; return [  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‚Enlight\_Controller\_Action\_PostDispatchSecure\_Backend‘ =\> ‚addTemplateDir‘  
&nbsp; &nbsp; &nbsp; &nbsp; ];  
&nbsp; &nbsp; }

&nbsp; &nbsp; public function addTemplateDir(Enlight\_Event\_EventArgs $args)  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; $controller = $args-\>get(‚subject‘);  
&nbsp; &nbsp; &nbsp; &nbsp; $view = $controller-\>View();  
&nbsp; &nbsp; &nbsp; &nbsp; $view-\>addTemplateDir(  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-\>getPath() . ‚/Resources/Views/‘  
&nbsp; &nbsp; &nbsp; &nbsp; );  
&nbsp; &nbsp; &nbsp; &nbsp; $view-\>extendsTemplate(‚backend/tackenberg\_pets/app.js‘);

&nbsp; &nbsp; }

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [28. Juli 2017 um 09:17 UTC](https://forum.shopware.com/t/fatal-error-uncaught-exception-smartyexception-with-message-unable-to-load-template-snippet/47087/8 "2017-07-28T09:17:05Z")

</div>

Hey,

That looks quite good. &nbsp;  
But&nbsp;I don’t think that you need to call the extendsTemplate method here. This method is only needed if you want to extend existing backend modules of Shopware. Your own module should work without the calling of the extendsTemplate method

Best regards from Schöppingen

&nbsp;Michael Telgmann
