# PHP Variable an Smarty übergeben

**URL:** https://forum.shopware.com/t/php-variable-an-smarty-ubergeben/49446
**Category:** Programmierung
**Created:** [14. November 2017 um 10:50 UTC](https://forum.shopware.com/t/php-variable-an-smarty-ubergeben/49446 "2017-11-14T10:50:41Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![simkli](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/simkli/32/13124_2.png) [@simkli](https://forum.shopware.com/u/simkli)
#### Post date: [14. November 2017 um 11:45 UTC](https://forum.shopware.com/t/php-variable-an-smarty-ubergeben/49446/5 "2017-11-14T11:45:28Z")

</div>

Ja, das sieht besser aus. Eines fehlt noch:

```
public function postDispatch(Enlight_Event_EventArgs $args)
{
  $subject = $args->getSubject(); // Controller 
  $view = $subject->View(); // View
  $view->assign("kundengruppe",Shopware()->System()->sUSERGROUPDATA['groupkey']);
}

```

Noch eine Empfehlung:

Enlight\_Controller\_Action\_PostDispatch\_Frontend -\>&nbsp;Enlight\_Controller\_Action\_PostDispatchSecure\_Frontend

Das verhindert, dass dein Code bei Fehlern o.ä. ausgeführt wird.

Viele Grüße

---

_[View the full topic](https://forum.shopware.com/t/php-variable-an-smarty-ubergeben/49446)._
