|
Posted by Dustin on 04/23/05 01:45
Hi,
I would like to have my options come from the template to make it easy
for designers to add/edit them instead of assigning from a PHP array.
Something like this
<select name="hdegree">
<option value=""></option>
<option value="High School" {isselected v=$hdegree o="High School"}>High
School</option>
<option value="Trade School" {isselected v=$hdegree, o="Trade
School"}>Trade School</option>
<option value="Associates Degree" {isselected v=$hdegree, o="Associates
Degree"}>Associates Degree</option>
<option value="Bachelor Degree" {isselected v=$hdegree, o="Bachelor
Degree"}>Bachelor Degree</option>
<option value="Advanced Degree" {isselected v=$hdegree, o="Advanced
Degree"}>Advanced Degree</option>
</select>
But would like it easier. I don't think this assign is valid but just
for sake of how I would like to do it.
{assign var=degrees value=array("High School","Trade School","Associates
Degree","Bachelor Degree","Advanced Degree")}
<select name="hdegree">
{html_options values=$degrees output=$degrees selected=$hdegree}
</select>
Maybe a variable modifier could turn something like this into a smarty
array variable?
{"High School,Trade School,Associates Degree,Bachelor Degree,Advanced
Degree"|arrayify:"degrees"}
Thanks,
Dustin
[Back to original message]
|