Question about select list functions

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Lucas
New Member
New Member
Posts: 7
Joined: Mon Nov 26, 2007 12:31 pm
Location: Netherlands

Question about select list functions

Post by Lucas »

Quote from the file `class.module.inc.php` regarding the functions CreateInputDropdown and CreateInputSelectList:

"An array of items to put into the dropdown list... they should be $key=>$value pairs"

However, when I look at the code in `modform.inc.php`:

Code: Select all

		$text .= '<option value="'.$value.'"';
			if ($selectedindex == $count || $selectedvalue == $value)
			{
				$text .= ' ' . 'selected="selected"';
			}
			$text .= '>';
			$text .= $key;
			$text .= '</option>';
I know the index of a select item is called a 'value' by HTML-standard, but this doesn't make sense to me... Now I have to feed this function an array like this:

Code: Select all

$list = array('Some text' => '1');
Looks very nasty to me, why is it done this way?
Post Reply

Return to “Developers Discussion”