|
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 |
sempere Smarty n00b
Joined: 17 Jul 2009 Posts: 3
|
Posted: Sun Jul 19, 2009 11:44 am Post subject: print value of php function in a Smarty template |
|
|
Hi!
I have a php function that returns a string, and in the template, on one hand I would like to compare this value and on the other, I would like to print it.
I can do the compare ( { if myfunction() == "" } ), but I can't find how print that value. I tried with {$myfunction()} and {myfunction()}, but with no result... They raise and Smarty error...
Can somebody give me a hand?
Thanks! |
|
Back to top |
|
alokin Smarty Regular
Joined: 14 Apr 2009 Posts: 96 Location: Belgrade, Serbia
|
Posted: Sun Jul 19, 2009 12:45 pm Post subject: |
|
|
When you say "function", do you mean Smarty plugin? It's kinda unusual to call PHP function in your template. You should evaluate that function in your PHP code, and then assign return value to Smarty.
But if you're trying to call some custom plugin function inside your template, you should simply do that this way: {someFunction}, which will output its return value. _________________ www.nikolaposa.in.rs |
|
Back to top |
|
sempere Smarty n00b
Joined: 17 Jul 2009 Posts: 3
|
Posted: Sun Jul 19, 2009 3:10 pm Post subject: |
|
|
I tried it so, but it continues raising a fatal error: unrecognized tab myfunction($foo). |
|
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
|