From f9878b7316afee9316d25b8036eccbdc3881877b Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 31 Jan 2001 22:55:52 +0000 Subject: [PATCH] Added ability to pass 'options' attribute to html_options. --- Smarty.addons.php | 41 +++++++++++++++++++++++++---------------- demo/index.php | 2 -- index.php | 2 -- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Smarty.addons.php b/Smarty.addons.php index 82b0a8a4..ec194ff4 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -155,24 +155,33 @@ function smarty_func_html_options() extract(func_get_arg(0)); - settype($output, 'array'); - settype($values, 'array'); - settype($selected, 'array'); - $html_result = ""; - for ($i = 0; $i < count($output); $i++) { - /* By default, check value against $selected */ - $sel_check = $values[$i]; - $html_result .= "\n"; + settype($selected, 'array'); + if (isset($options)) { + settype($options, 'array'); + foreach ($options as $key => $value) { + $html_result .= "