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

register_outputfilter ignore textarea

 
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
docdawson
Smarty n00b


Joined: 28 Jan 2015
Posts: 3

PostPosted: Wed Jan 28, 2015 7:00 am    Post subject: register_outputfilter ignore textarea Reply with quote

Hi,

I have an output filter like this
Code:

function smarty_outputfilter_protect_email($tpl_output, &$smarty) {
// make html <a href="mailto"> with no @ sign (will be replaced via javascript)
}
....
....
$smarty->autoload_filters = array('output' => array('protect_email'));


Following problem exists: if I have an email address in a textarea (read from database) it will be filtered and I see the HTML in the textarea.

Is there a way to set some template parts or maybe an included template to ignore that filter?

Another question: Why an email address is not filtered in an input-email (HTML5) field? Is that a browser feature (e.g. the browser filters out the html)?

Solution: I can filter the addresse before passing to the template (@ to & #64; ), so the filter function won't match.
Anyway I want to know if there is a way to ignore the filter.

Thanks
Doc


Last edited by docdawson on Wed Jan 28, 2015 1:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Jan 28, 2015 12:51 pm    Post subject: Reply with quote

Do not use output filter for this purpose.
Use m odifiers where appropriate.
Back to top
View user's profile Send private message
docdawson
Smarty n00b


Joined: 28 Jan 2015
Posts: 3

PostPosted: Wed Jan 28, 2015 1:19 pm    Post subject: Reply with quote

But then I have to use this modifier for each address. For me the outputfilter is very userful. And on documentation site the filter is used for hiding the @:
http://www.smarty.net/docs/en/plugins.outputfilters.tpl

So I'll hide the @ (& #64; ) before passing to Smarty. This I have to do only in some rare cases.

Thanks for the info. I'll keep this in mind, if the problems with the filter are growing Wink
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Jan 28, 2015 2:53 pm    Post subject: Reply with quote

No, you have to use this modifier for each appropriate text block.
The content of <textarea> element does not constitute the "appropriate block".
Back to top
View user's profile Send private message
docdawson
Smarty n00b


Joined: 28 Jan 2015
Posts: 3

PostPosted: Wed Jan 28, 2015 3:59 pm    Post subject: Reply with quote

Ok. Then I have to check what I can do with those modifiers. Thanks.
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