dynamically creating variable names
| From: | Ronny 'Ronino' Multrus | Date: | Fri, 07 Mar 2003 19:33:23 +0000 |
| Subject: | dynamically creating variable names | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8482@lists.php.net to get a copy of this message | ||
Hello,
I recently read about the Smarty Template Engine, tested it and was amazed:
It's wonderful!
Okay, now I came across a problem: I'm looking for a way of dynamically
creating variable names. In an html-form I have different sections, so I give
the input names different prefixes, according to the respective section:
name="{$varPrefix}_example" will become something like name="prefix_example".
Now the problem is that I can't access the according variable in smarty's
post-array. I've read that in the latest release 2.5RC1 something like
$smarty.post.$varName is possible, but what I need is something like
$smarty.post.[$varPrefix . "_example"].
Do you have any suggestions how to do that? Or how could I create $varName
before accessing the post-array to have something like
$smarty.post.$varWithPrefix?
Thanx in advance
Ronino