# OXID way to add a smarty modifier

**URL:** <https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633>\
**Category:** English forums\
**Tags:** templates-design\
**Created:** [September 9, 2012, 11:49am UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633 "2012-09-09T11:49:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![toxid](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/t/bc79bd/32.png) [@toxid](https://forum.oxid-esales.com/u/toxid)\
**Post date:** [September 9, 2012, 11:49am UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/1 "2012-09-09T11:49:39Z")

</div>

Hey.  
I want to add a smarty modifier. Is there an “OXID way” to archive this? I think it would work to decorate \oxUtilsView::\_fillCommonSmartyProperties() or \oxUtilsView::getSmarty() and regsiter the modifier function there. But I would like to avoid overwriting existing methods (it has to run in professional edition and I don’t like to hack around in an undocumented way).

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [September 9, 2012, 12:02pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/2 "2012-09-09T12:02:08Z")

</div>

im used to put my own modifiers into the smarty/plugins folder

---

<div class="post-metadata">

**Author:** ![toxid](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/t/bc79bd/32.png) [@toxid](https://forum.oxid-esales.com/u/toxid)\
**Post date:** [September 9, 2012, 12:03pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/3 "2012-09-09T12:03:44Z")

</div>

Into the core directory?

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [September 9, 2012, 12:07pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/4 "2012-09-09T12:07:11Z")

</div>

yes…

---

<div class="post-metadata">

**Author:** ![toxid](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/t/bc79bd/32.png) [@toxid](https://forum.oxid-esales.com/u/toxid)\
**Post date:** [September 9, 2012, 12:16pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/5 "2012-09-09T12:16:43Z")

</div>

:eek: I wrote a module to implement an event dispatcher and now I decorated the getSmarty() method to trigger an event smarty.postInit with the newly created smarty object. Then I register an observer in another module to add the modifier. I think that should work.  
But … of course it would be nice to hear somebody that could tell that OXID has implemented a way to make templates extensible without touching the core or having to use such unreliable class method extensions.

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [September 9, 2012, 12:52pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/6 "2012-09-09T12:52:01Z")

</div>

so feel free to suggest a better/reliable way

---

<div class="post-metadata">

**Author:** ![toxid](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/t/bc79bd/32.png) [@toxid](https://forum.oxid-esales.com/u/toxid)\
**Post date:** [September 9, 2012, 12:58pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/7 "2012-09-09T12:58:57Z")

</div>

In the metadata.php add:

‘smarty’ =\> array(‘modifiers’ =\> array(‘mymodifier’, array(‘mymod/smarty/modifiers’,‘mymodifier’)));

It would be very easy to add that into the core.

My suggestion for developers that do not work at OXID is the above one. You have a function that gets the smarty object passed evers time a new smarty object will be created and you have that dacorator around the getSmarty() method that triggers the smarty.postInit event. If they change something in the the \oxViewUtils class you just have to find another way to place your hook.

---

<div class="post-metadata">

**Author:** ![baron](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/b/9de0a6/32.png) [@baron](https://forum.oxid-esales.com/u/baron)\
**Post date:** [May 4, 2013, 2:32pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/8 "2013-05-04T14:32:06Z")

</div>

Yes great and so I don’t like to hack around in an undocumented way

---

<div class="post-metadata">

**Author:** ![system](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/system/32/4245_2.png) [@system](https://forum.oxid-esales.com/u/system)\
**Post date:** [July 13, 2026, 7:39pm UTC](https://forum.oxid-esales.com/t/oxid-way-to-add-a-smarty-modifier/59633/9 "2026-07-13T19:39:32Z")

</div>


