note 79284 added to function.timezone-identifiers-list

From: Date: Mon, 19 Nov 2007 18:14:51 +0000
Subject: note 79284 added to function.timezone-identifiers-list
Groups: php.notes 
Request: Send a blank email to php-notes+get-132408@lists.php.net to get a copy of this message
This is the updated code from below. This one has been debugged so it doesn't receive any warnings or errors like the code below will receive. Hope this helps. <?php function get_tz_options($selectedzone, $label, $desc = '') { echo '<div class="label"><label for="edited_user_timezone">'.$label.':</label></div>'; echo '<div class="input"><select name="edited_user_timezone">'; function timezonechoice($selectedzone) { $all = timezone_identifiers_list(); $i = 0; foreach($all AS $zone) { $zone = explode('/',$zone); $zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : ''; $zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : ''; $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : ''; $i++; } asort($zonen); $structure = ''; foreach($zonen AS $zone) { extract($zone); if($continent == 'Africa' || $continent == 'America' || $continent == 'Antarctica' || $continent == 'Arctic' || $continent == 'Asia' || $continent == 'Atlantic' || $continent == 'Australia' || $continent == 'Europe' || $continent == 'Indian' || $continent == 'Pacific') { if(!isset($selectcontinent)) { $structure .= '<optgroup label="'.$continent.'">'; // continent } elseif($selectcontinent != $continent) { $structure .= '</optgroup><optgroup label="'.$continent.'">'; // continent } if(isset($city) != ''){ if (!empty($subcity) != ''){ $city = $city . '/'. $subcity; } $structure .= "<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected "':'')." value=\"".($continent.'/'.$city)."\">".str_replace('_',' ',$city)."</option>"; //Timezone } else { if (!empty($subcity) != ''){ $city = $city . '/'. $subcity; } $structure .= "<option ".(($continent==$selectedzone)?'selected="selected "':'')." value=\"".$continent."\">".$continent."</option>"; //Timezone } $selectcontinent = $continent; } } $structure .= '</optgroup>'; return $structure; } echo timezonechoice($selectedzone); echo '</select>'; echo '<span class="notes"> '.$desc.' </span></div>'; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 76.101.40.121 ---- Manual Page -- http://www.php.net/manual/en/function.timezone-identifiers-list.php Edit -- https://master.php.net/note/edit/79284 Del: integrated -- https://master.php.net/note/delete/79284/integrated Del: useless -- https://master.php.net/note/delete/79284/useless Del: bad code -- https://master.php.net/note/delete/79284/bad+code Del: spam -- https://master.php.net/note/delete/79284/spam Del: non-english -- https://master.php.net/note/delete/79284/non-english Del: in docs -- https://master.php.net/note/delete/79284/in+docs Del: other reasons-- https://master.php.net/note/delete/79284 Reject -- https://master.php.net/note/reject/79284 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132408) next »