Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Allow insert functions to trigger modifiers on output
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Sep 18, 2008 3:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Sep 18, 2008 6:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
sma
Smarty Rookie


Joined: 14 Sep 2008
Posts: 9

PostPosted: Thu Sep 18, 2008 7:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Sep 18, 2008 8:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
sma
Smarty Rookie


Joined: 14 Sep 2008
Posts: 9

PostPosted: Thu Sep 18, 2008 10:48 pm    Post subject: Reply with quote

Aye. Does seem my idea is less efficient than I'd originally thought. So, I guess this idea can be canned.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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
Protected by Anti-Spam ACP