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

|smarty:nodefaults

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Wed Mar 03, 2010 4:23 am    Post subject: |smarty:nodefaults Reply with quote

Smarty 3 does not recognize |smarty:nodefaults
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Mar 03, 2010 2:30 pm    Post subject: Reply with quote

You should really use Smarty 3 variable filters instead of the smarty 2 default modifiers.
Back to top
View user's profile Send private message Visit poster's website
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Wed Mar 03, 2010 5:05 pm    Post subject: Reply with quote

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


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Mar 03, 2010 6:13 pm    Post subject: Reply with quote

It goes something like:

Code:
$smarty->register->variableFilter('myFilterFunc');


And I think the syntax to selectively disable the filter is:

Code:
{$foo nofilter}


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
View user's profile Send private message Visit poster's website
emt
Smarty Regular


Joined: 10 Dec 2009
Posts: 43

PostPosted: Thu Mar 04, 2010 3:01 pm    Post subject: Reply with quote

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
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 -> Smarty 3 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