|
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 |
cbschuld Smarty n00b
Joined: 22 Aug 2005 Posts: 1 Location: Gilbert, Arizona
|
Posted: Mon Aug 22, 2005 8:50 am Post subject: Variable Parameters |
|
|
Hello All:
I have a request to have variable-based parameters for smarty plugins -- OR -- I do not fully understand how to use them if this is already supported.
Here is what I would like to do:
I have a plugin function called smarty_function_request that requires variable parameter values. Here are a few examples of what I am attempting to do:
Code: |
{request someparameter-$pageid1=7 someparameter-$pageid2=7}
{request someparameter-$id[0]=7 someparameter-$id[1]=7}
{request someparameter-$object->getId()=7 someparameter-$anotherObject->getId()=7}
|
These smarty statements would then be essentially aliases of the following (assuming the following values: $pageid1 = 1, $pageid2 = 2, $id[0] = 'cat', $id[1] = 'dog', $object->getId() returns 23, $anotherObject->getId() returns 24):
Code: |
{request someparameter-1=7 someparameter-2=7}
{request someparameter-cat=7 someparameter-dog=7}
{request someparameter-23=7 someparameter-24=7}
|
What I would see in my plugin then would be "processed" parameters.
If there is already support for this then egg on my face, but please let me know!
Thanks for all the great work!
--Chris |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Aug 22, 2005 4:36 pm Post subject: |
|
|
You can't, nor should you have to. Parameter names are a known item. Maybe you should just pass an associative array of values:
Code: | {request params=$params} |
where $params would be:
Code: | $params = array(
'pageid1' => '1',
'pageid2' => '2',
'id[0]' => 'cat'
); |
|
|
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
|