|
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 |
ideadawn Smarty n00b
Joined: 20 Jan 2010 Posts: 3
|
Posted: Wed Jan 20, 2010 9:02 am Post subject: How a function parse the assigned arguments in params? |
|
|
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 |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Wed Jan 20, 2010 9:05 am Post subject: |
|
|
Hello,
Something like : {myfunc id=$id}
Regards |
|
Back to top |
|
ideadawn Smarty n00b
Joined: 20 Jan 2010 Posts: 3
|
Posted: Wed Jan 20, 2010 9:32 am Post subject: |
|
|
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 |
|
ideadawn Smarty n00b
Joined: 20 Jan 2010 Posts: 3
|
Posted: Wed Jan 20, 2010 10:01 am Post subject: |
|
|
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 |
|
|
|
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
|