Re: [SMARTY] user function for 'if' stmt
| From: | Roman Neuhauser | Date: | Mon, 11 Nov 2002 17:21:32 +0000 |
| Subject: | Re: [SMARTY] user function for 'if' stmt | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6394@lists.php.net to get a copy of this message | ||
# river@sbox.tu-graz.ac.at / 2002-11-11 02:45:24 +0100:
> I'd like to create a new function which I can implement into an 'if'
> statement. Should look like this
>
> {if user_right == 1}
> ..
>
> therefore I created a custom function:
>
> function smarty_function_user_right($params, &$smarty)
> {
> echo '1';
> }
>
> my problem is that my if statement always fails. I tried to build a
> function with "echo" and also with "return" but it didn't work.
> Smarty manual didn't help me
>
> any suggestions?
function user_right()
{
return 1;
}
$smarty = new Smarty;
$smarty->display('foo.tpl');
foo.tpl:
{if user_right() == 1}
...
{/if}
IOW, Smarty functions don't mix with standard PHP functions.
--
If you cc me or take the list(s) out completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html