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

How do I actually use {setfilter} ?

 
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 -> General
View previous topic :: View next topic  
Author Message
HandyCAPS
Smarty n00b


Joined: 12 Nov 2015
Posts: 1

PostPosted: Thu Nov 12, 2015 2:29 pm    Post subject: How do I actually use {setfilter} ? Reply with quote

I want to run some blocks past a filter function to do some stuff depending on the content, so I thought {setfilter} would be an ideal fit. The docs however once again fail to provide any useful information on how to actually use this function. Trying to register the function with
Code:
smarty->loadFilter('output', 'test');
results in the content of the entire page running through my filter, rather then just the contents surrounded by {setfilter test}{/setfilter}. I really just want the bit in between the tags, which is what the docs tell me it should do. I also don't want to register every filter in a config file, I want to use them like I would a custom block. Smarty recognizes block tags and custom plugin tags without me registering them, why wouldn't the same work for a filter function ?

Are there any complete examples of how to use {setfilter} anywhere ? Is this the functionality I need or are there better ways to check the contents of a tpl before compiling ?

Here's an example of what I would try to do:

If I have two templates that both get pulled in to a table, I want to make sure both have the same number of <td>'s. In the filter function I could count the <td>'s in both and then fill one with empty <td>'s to make them even.
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 -> General All times are GMT
Page 1 of 1

 
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