# theme / smarty function / mysql

**URL:** <https://forum.shopware.com/t/theme-smarty-function-mysql/52209>\
**Category:** Programmierung\
**Created:** [5. April 2018 um 14:02 UTC](https://forum.shopware.com/t/theme-smarty-function-mysql/52209 "2018-04-05T14:02:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)\
**Post date:** [5. April 2018 um 14:02 UTC](https://forum.shopware.com/t/theme-smarty-function-mysql/52209/1 "2018-04-05T14:02:31Z")

</div>

Hi, Ich würde gern im Template auf eine smarty function.php zugeifen. Wie kann ich in der function selbst eine MySQL Abfrage starten? Kann ich da auf einen querybuilder zurückgreifen oder muss man die mysql verbindung neu machen? Danke und Gruss.

---

<div class="post-metadata">

**Author:** ![hsoebbing](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@hsoebbing](https://forum.shopware.com/u/hsoebbing)\
**Post date:** [5. April 2018 um 14:21 UTC](https://forum.shopware.com/t/theme-smarty-function-mysql/52209/2 "2018-04-05T14:21:08Z")

</div>

Du kannst in der Smarty Funktion vermutlich das Shopware()-Singleton aufrufen. Damit hast Du Zugriff auf den DIC (Shopware()-\>Container()) und damit auf alle Services die Shopware so hat
