|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
eadz Smarty Regular
Joined: 30 Apr 2003 Posts: 61 Location: Auckland, New Zealand
|
Posted: Wed May 21, 2003 12:02 pm Post subject: Modifier calling other modifiers |
|
|
Hi there,
I want to make a modifier plugin, that calls other plugins based on settings in a database.
I.e. {$myvar|dbmodify} and it would look up the database, and then depending on the setting in the database, apply nl2br and other modifiers.
How would I call another modifier from within a modifier plugin? _________________ bBlog - Smarty based blogging software
I work for Webforce web site design ( Auckland, NZ ) |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed May 21, 2003 5:37 pm Post subject: |
|
|
In your new modifier, plugin, whatever...
eg:
require_once $smarty->_get_plugin_filepath('modifier', 'capitalize');
then call the modifier's function directly:
$output = smarty_modifier_capitalize( $input );
Rinse, Repeat. |
|
Back to top |
|
eadz Smarty Regular
Joined: 30 Apr 2003 Posts: 61 Location: Auckland, New Zealand
|
|
Back to top |
|
ubaldo Smarty Regular
Joined: 21 Apr 2003 Posts: 35 Location: Barcelona, Spain
|
Posted: Mon Jun 09, 2003 9:37 am Post subject: Yes, but another instance of smarty? |
|
|
Unlike smarty functions, modifier functions don't get a smarty pointer reference, so, another smarty instance has to be created. In my case, the smarty instance isn't very cheap, because i do some extra initialization (I subclass Smarty)
I guess that there is no other way around. My question is, why do I get a smarty pointer in custom functions and not in custom modifiers? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Jun 09, 2003 10:11 am Post subject: |
|
|
Hi ubaldo. It sounds like you would be interested in this topic concerning $this in modifiers.
I think it would be nice if all api functions received $this |
|
Back to top |
|
ubaldo Smarty Regular
Joined: 21 Apr 2003 Posts: 35 Location: Barcelona, Spain
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|