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_function return values?

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


Joined: 22 Jul 2003
Posts: 2

PostPosted: Tue Jul 22, 2003 4:00 am    Post subject: register_function return values? Reply with quote

Is it possible to register a function that returns true/false and use that function in an {if} block?

For instance:
Code:

function returnTrue($this = true) {
    return $this;
}

$smarty->register_function("returnTrue","returnTrue");

...

{if not returnTrue(false)}
I'm true.
{/if}

Back to top
View user's profile Send private message
griddy
Smarty n00b


Joined: 22 Jul 2003
Posts: 2

PostPosted: Tue Jul 22, 2003 4:07 am    Post subject: Reply with quote

Nevermind Smile It works fine. I mistyped a variable.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Tue Jul 22, 2003 7:22 am    Post subject: Reply with quote

FYI: you don't even have to register it. you can use any php-function inside {if}.
only with $smarty->security=true you have to to supply a list of allowed functions. see: http://smarty.php.net/manual/en/variable.security.settings.php for reference.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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