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

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.

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. 
For more help, it would be nice if you could provide your plugin structure

Best regards from Schöppingen

cool Michael Telgmann

Hello,

Thank you for the quick reply.

How can i share plugin structure ?

 

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? 

Best regards from Schöppingen

cool Michael Telgmann

This is the screenshop of my plugin structure:

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

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

 

   public static function getSubscribedEvents()
    {
        return [
            ‚Enlight_Controller_Action_PostDispatchSecure_Backend‘ => ‚addTemplateDir‘
        ];
    }

    public function addTemplateDir(Enlight_Event_EventArgs $args)
    {
        $controller = $args->get(‚subject‘);
        $view = $controller->View();
        $view->addTemplateDir(
            $this->getPath() . ‚/Resources/Views/‘
        );
        $view->extendsTemplate(‚backend/tackenberg_pets/app.js‘);

    }

Hey,

That looks quite good.  
But 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

 Michael Telgmann