|
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 |
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 18, 2008 3:55 pm Post subject: |
|
|
Custom functions with attributes are already handled by the compiler.
{somefunction|modifier|modifier|modifier arg1="word" arg2=2785}
Also the way how the content of an {insert} is injected into cached HTML output makes the implementation of modifiers very difficult.... |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 18, 2008 6:15 pm Post subject: |
|
|
sma I have spend some more time of investigation and experiements how modifiers could be aplied to the {insert} and I gave up. The implemantation of how the {insert} tag is compiled in the template and how the content is injected in cached HTML output does not allow it. It would require a completely different solution of handling inserts.
The only work around which will work is using a registered function or plugin and call it in the template like this
Code: | {nocache}{somefunction|modifier|modifier|modifier arg1="word" arg2=2785}{/nocache} |
|
|
Back to top |
|
sma Smarty Rookie
Joined: 14 Sep 2008 Posts: 9
|
Posted: Thu Sep 18, 2008 7:12 pm Post subject: |
|
|
Hows about just a php function inside of $smarty that lets you apply modifiers to a string? For example:
$smarty->applyModifiers('words','capitalize|escape:"htmlall"');
Of course, this means the function would have to register somewhere which modifiers it wants to use, or preload pages and have applyModifiers only search function_exists. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 18, 2008 8:22 pm Post subject: |
|
|
With the {nocache} approach the modifier handling is compiled just once. If you call a cached page the compiled code of the nocache section is just executed.
Your applyModifier methode has to do parsing and other stuff each time a page is being call.
I think you will gain nothing. |
|
Back to top |
|
sma Smarty Rookie
Joined: 14 Sep 2008 Posts: 9
|
Posted: Thu Sep 18, 2008 10:48 pm Post subject: |
|
|
Aye. Does seem my idea is less efficient than I'd originally thought. So, I guess this idea can be canned. |
|
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
|