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

How a function parse the assigned arguments in params?

 
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 -> Help Wanted (commercial)
View previous topic :: View next topic  
Author Message
ideadawn
Smarty n00b


Joined: 20 Jan 2010
Posts: 3

PostPosted: Wed Jan 20, 2010 9:02 am    Post subject: How a function parse the assigned arguments in params? Reply with quote

I write a function to do something like this:

function smarty_function_myfunc($params, & $smarty)
{
return 'id='.$params['id'];
}

I use it in templates like this:

{myfunc id=1}

but there is a problem, because the id is dynamic.

I assigned a argument id like this:
$smarty->assign('id', $id);

Is there some way to get the dynamic argument id for smarty_function_myfunc??

Thanks so much!!
Back to top
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Wed Jan 20, 2010 9:05 am    Post subject: Reply with quote

Hello,

Something like : {myfunc id=$id}

Regards
Back to top
View user's profile Send private message Send e-mail
ideadawn
Smarty n00b


Joined: 20 Jan 2010
Posts: 3

PostPosted: Wed Jan 20, 2010 9:32 am    Post subject: Reply with quote

Thanks!
I didn't describe clearly.

If the params is like this:
{myfunc go='c=all&id=$id'}

how should I do?
Back to top
View user's profile Send private message
ideadawn
Smarty n00b


Joined: 20 Jan 2010
Posts: 3

PostPosted: Wed Jan 20, 2010 10:01 am    Post subject: Reply with quote

Thanks again! I have shot my problem.

{myfunc go='c=all&id=$id'} is not a right usage.

To deal with this problem, I used more params like this:
{myfunc c='all' id=$id}
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 -> Help Wanted (commercial) 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