Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
eval can call a function?

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jozeph
Smarty n00b


Joined: 23 May 2009
Posts: 2

PostPosted: Sat May 23, 2009 7:57 pm    Post subject: eval can call a function? Reply with quote

Hi guys,

Along these years this is the first time that I ask some question about smarty.

Today, occur the follow situation. I need a way to do something like:

{eval var={getlang data=$body lang=$language}}

I've tried a lot of things but without success. Someone can help me with this? Please...


Last edited by jozeph on Wed May 05, 2010 11:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
alokin
Smarty Regular


Joined: 14 Apr 2009
Posts: 96
Location: Belgrade, Serbia

PostPosted: Sat May 23, 2009 8:35 pm    Post subject: Reply with quote

I think only way to accomplish that is to modify that getlang function to follow "assign pattern", so it can accept assign param, which means that result of that function will be assigned to some variable in template, i.e.:
Code:

{getlang data=$body lang=$language assign=foo}
{eval var=$foo}

_________________
www.nikolaposa.in.rs
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Sat May 23, 2009 8:55 pm    Post subject: Reply with quote

or:

Code:
{capture name="foo"}{getlang data=$body lang=$language}{/capture}
{eval var=$smarty.capture.foo}
Back to top
View user's profile Send private message Visit poster's website
jozeph
Smarty n00b


Joined: 23 May 2009
Posts: 2

PostPosted: Sun May 24, 2009 9:18 pm    Post subject: Reply with quote

I've tried this, works fine! Thanks.

mohrt wrote:
or:

Code:
{capture name="foo"}{getlang data=$body lang=$language}{/capture}
{eval var=$smarty.capture.foo}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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