Dynamic variables

From: Date: Tue, 29 Apr 2003 12:01:37 +0000
Subject: Dynamic variables
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9414@lists.php.net to get a copy of this message
Hello, I have a PHP script that assigns N variables to smarty template, something like this: for ($i=0;$i<N;$i++) { $var = "sel_$i"; $smarty->assign($var, $$var); } How do I use these variables in a section or foreach loop? To explain my need, consider that "sel_$i" points to an array of values that will feed the selected attribute of an {html_options} loop. The idea is to apply the "selected" state to all select elements in a form. The number of select elements is dynamic, as retrieved from a database. Thank you!

« previous php.smarty.general (#9414) next »