|
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 |
ilyalyu Smarty Regular
Joined: 03 Nov 2009 Posts: 72
|
Posted: Wed Mar 03, 2010 4:23 am Post subject: |smarty:nodefaults |
|
|
Smarty 3 does not recognize |smarty:nodefaults |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 03, 2010 2:30 pm Post subject: |
|
|
You should really use Smarty 3 variable filters instead of the smarty 2 default modifiers. |
|
Back to top |
|
ilyalyu Smarty Regular
Joined: 03 Nov 2009 Posts: 72
|
Posted: Wed Mar 03, 2010 5:05 pm Post subject: |
|
|
Ok. I'll wait for documentation:
Quote: | VARIBLE FILTERS:
================
(to be filled in)
|
Though as much backward compatibility as possible would be good. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 03, 2010 6:13 pm Post subject: |
|
|
It goes something like:
Code: | $smarty->register->variableFilter('myFilterFunc'); |
And I think the syntax to selectively disable the filter is:
I think the myFilterFunc requires two args: the string, and the smarty object. I'm not 100% sure on this, Uwe can correct me if it's wrong. And yes compatibility will be looked at, although default modifiers were an afterthought in Smarty 2, and never did work very well. |
|
Back to top |
|
emt Smarty Regular
Joined: 10 Dec 2009 Posts: 43
|
Posted: Thu Mar 04, 2010 3:01 pm Post subject: |
|
|
The quickest way to get to grips with it is to take a look at the included variablefilter.htmlspecialchars.php (see the Smarty plugins directory) which is defined like this:
Code: | function smarty_variablefilter_htmlspecialchars($source, $smarty)
{
return htmlspecialchars($source, ENT_QUOTES);
}
|
So simply accept $source and $smarty, and do your processing on the source using a 'return', and you've got it. |
|
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
|