Dynamic variable names inside Smarty tags
| From: | Duke Ionescu | Date: | Thu, 19 Sep 2002 22:37:11 +0000 |
| Subject: | Dynamic variable names inside Smarty tags | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6000@lists.php.net to get a copy of this message | ||
I want to know if the following is possible with Smarty. I want to have a
variable name inside a Smarty tag which is built dynamically. Let's say I
have assigned the following variables from PHP using Smarty->assign:
current = 2
table_2 = 'some data'
I want to be able to build the name of the second variable, "table_2", on
the fly by concatenating the string "table_" with the value of variable
"current", so the end result is "table_2" and it gets evaluated as a
variable name so that I can, for example, use it in the "loop" attribute of
a {section}.