Re: [SMARTY] looping through variable names
| From: | Kathleen Krause-Thompson | Date: | Wed, 17 Aug 2005 23:20:28 +0000 |
| Subject: | Re: [SMARTY] looping through variable names | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-12972@lists.php.net to get a copy of this message | ||
That doesn't quite answer my question. Here is another posting with the php.
<?php
for ($i=1;$i<=$_SESSION['budgetPos'];$i++) {
$str = 'budget' . $i;
if (isset($_SESSION[$str])) {
$smarty->assign($str,$_SESSION[$str]);
}
}
?>
{*smarty*}
<p>Job Title: {$budget1.jobTitle} Percent of Full Time:{$budget1.percentFullTime}</p>
<p>Job Title: {$budget2.jobTitle} Percent of Full Time:{$budget2.percentFullTime}</p>
-----------------------------------------------------------------------------------------------------
How would I setup a loop that will number the array variable names appropriately so that I
don't have to code each section?
Job Title: {$budgetx.jobTitle}
I appreciate the advice.