# Plugin unable to load template part 2

**URL:** <https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641>\
**Category:** International (English Only)\
**Tags:** themes--design\
**Created:** [9. Mai 2017 um 07:42 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641 "2017-05-09T07:42:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dNovoNiels](https://avatars.discourse-cdn.com/v4/letter/d/85e7bf/32.png) [@dNovoNiels](https://forum.shopware.com/u/dNovoNiels)\
**Post date:** [9. Mai 2017 um 07:42 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641/1 "2017-05-09T07:42:19Z")

</div>

Hello Shopware community,

&nbsp;

This is more or less a continuation of [my previous post here](https://forum.shopware.com/discussion/46327/plugin-unable-to-load-template). Same problem, slightly diffirent setting.

Again, i&nbsp;am trying to load a custom template on a custom controller but i am getting the following error.

> Unable to load template snippet ‚frontend/event\_detail/index.tpl|frontend/plugins/seo/index.tpl‘ in engine/Library/Smarty/sysplugins/smarty\_internal\_templatebase.php on line 127

The difference with this problem compared to my previous one, is that this time i am not subscribing to a event to load the controller, but i am redirecting the user from one controller to another controller through an html a tag.

I am using the following code in the first controllers template, this is where the redirect happens:

```
{extends file="parent:frontend/index/index.tpl"}

{block name="frontend_index_content_left"}{/block}

{block name="frontend_index_content"}
    
        {foreach $messages as $message}
            {$message}
            View
        {/foreach}
    
{/block}

```

I am getting redirected to the correct page but the template isn’t loading and the error stated above is generated.

My&nbsp;directory structure looks like this:

The code inside my EventDetail.php file is a simple indexAction()&nbsp;that assigns an array to the template.

As far as i can tell i have the correct directory structure and correct names for my files. [Here is a download link to my plugin](https://files.fm/u/sxhc5knv).

Any help would be greatly appreciated 🙂

---

<div class="post-metadata">

**Author:** ![Patrick\_Stahl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/patrick_stahl/32/7679_2.png) [@Patrick\_Stahl](https://forum.shopware.com/u/Patrick_Stahl)\
**Post date:** [9. Mai 2017 um 09:15 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641/2 "2017-05-09T09:15:13Z")

</div>

Hey @dNovoNiels‍,

I downloaded your example plugin and only got a single issue:  
The controller was not yet registered in your **DnovoEvents.php** , so you have to add code like that:

```
public static function getSubscribedEvents()
{
    return [
        ....
        'Enlight_Controller_Dispatcher_ControllerPath_Frontend_EventDetail' => 'onGetFrontendDetailsController'
    ];
}

/**
 * @return string
 */
public function onGetFrontendDetailsController()
{
    $this->container->get('Template')->addTemplateDir($this->getPath() . '/Resources/views/');

    return $this->getPath() . '/Controllers/Frontend/EventDetail.php';
}

```

After I added the new controller, I could successfully load the page&nbsp;[myShop.de/EventDetail](http://myShop.de/EventDetail) - your template was loaded properly then.  
No idea why you’re facing the “Template could not be loaded” error, since your controller wasn’t registered yet.

Does this information help you?

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

---

<div class="post-metadata">

**Author:** ![dNovoNiels](https://avatars.discourse-cdn.com/v4/letter/d/85e7bf/32.png) [@dNovoNiels](https://forum.shopware.com/u/dNovoNiels)\
**Post date:** [9. Mai 2017 um 09:24 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641/3 "2017-05-09T09:24:39Z")

</div>

yep, this awnsers my question ![Smile](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/smile.png "Smile")&nbsp;thanks again for the help

somehow i thought i wouldn’t have to subsribe to an event to get this to work ![Undecided](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/undecided.png "Undecided")

---

<div class="post-metadata">

**Author:** ![Patrick\_Stahl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/patrick_stahl/32/7679_2.png) [@Patrick\_Stahl](https://forum.shopware.com/u/Patrick_Stahl)\
**Post date:** [9. Mai 2017 um 09:32 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641/4 "2017-05-09T09:32:07Z")

</div>

You need to register each custom controller to Shopware.

E.g. you have 4 custom controllers, then you’ll also need four additional events for Shopware to know your custom controllers. 🙂

---

<div class="post-metadata">

**Author:** ![dNovoNiels](https://avatars.discourse-cdn.com/v4/letter/d/85e7bf/32.png) [@dNovoNiels](https://forum.shopware.com/u/dNovoNiels)\
**Post date:** [9. Mai 2017 um 09:35 UTC](https://forum.shopware.com/t/plugin-unable-to-load-template-part-2/45641/5 "2017-05-09T09:35:37Z")

</div>

good to know that for future projects 🙂
