html options from template

From: Date: Fri, 22 Apr 2005 22:45:50 +0000
Subject: html options from template
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12537@lists.php.net to get a copy of this message
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

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